From 3c4cfc5b5679cd5e46246612a902fb275181effa Mon Sep 17 00:00:00 2001 From: lhark Date: Thu, 3 Oct 2019 12:36:28 -0400 Subject: [PATCH] Add a truckload of new tidbits --- how_to | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 171 insertions(+), 6 deletions(-) diff --git a/how_to b/how_to index 498e7ac..c937d2b 100644 --- a/how_to +++ b/how_to @@ -127,9 +127,13 @@ PDF : AUR -> pdftk : Merge pdf : pdftk input1.pdf input2.pdf input3.pdf cat output output.pdf - Extract pages : + Extract pages : pdftk input.pdf cat output out.pdf # range can be -, more info at pdftk --help + Add images and other files in a single pdf: + convert [jpg|png|txt|pdf|...] output.pdf + # Might need to tweak /etc/ImageMagick-7/policy.xml + # https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion D-Bus : To reload service files /usr/share/dbus-1/services/ @@ -163,7 +167,7 @@ Drag & drop files: Fix hardware clock (with chrony): sudo chronyc makestep - trimrtc + trimrtc quit Alternative to trimrtc: sudo hwclock --systohc @@ -183,6 +187,8 @@ Use scanner from command line If invalid argument: scanimage -L scanimage --device ... + For HP network hardware, use hplip's: + hp-makeuri | grep "SANE URI:" Example to scan US letter in good quality scanimage --device "plop" --resolution 300 --format jpeg -y 280 --mode Color > whatevs.jpg @@ -206,6 +212,9 @@ Video and audio editing: ffmpeg -i in.mp4 -an out.mp4 Nvidia hardware encoding optirun ffmpeg -i in.mp4 -c:v h264_nvenc -crf 23 out.mp4 + Gif to mp4 for browsers/the web: + # https://unix.stackexchange.com/a/294892 + ffmpeg -i in.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4 RE .net apps: ilspymono (can be empty) @@ -226,7 +235,7 @@ Mount as user: Borg backup: borg init --encryption=repokey-blake2 - borg create -v --stats --progress --compression zlib /mnt//home/::{now} /home/ + borg create -v --stats --progress --compression zlib "/mnt//home/::{now}" /home/ borg list borg check --verify-data --progress borg mount @@ -352,6 +361,8 @@ Easy LaTeX compilation: $ trizen -S tectonic $ tectonic .tex Should automatically resolve all dependencies + Also takes care of biblatex + Uses Xetex to compile Rename files from date of creation: for f in *;do @@ -497,9 +508,16 @@ Uncompress android .ab backup files: Fix: Failed to activate service 'org.freedesktop.login1': timed out: If dbus has been restarted, don't forget to restart elogind/systemd-logind -Artilinux steam lib32-systemd fix: - https://forum.artixlinux.org/index.php/topic,633.msg7437.html - [Attached file]: resources/lib32-systemd-dummy.pkgbuild +Artix: + Artixlinux pacman gpg unknown trust fix: + sudo pacman-key --init + sudo pacman-key --populate archlinux artix + + Artixlinux steam lib32-systemd fix: + https://forum.artixlinux.org/index.php/topic,633.msg7437.html + [Attached file]: resources/lib32-systemd-dummy.pkgbuild + Open-rc keymap: + /etc/conf.d/keymaps LibreOffice unlock write-protected doc: Format -> Sections... -> [Uncheck Protect in "Write protection"] @@ -530,3 +548,150 @@ Simple python HTTP server: python -m http.server [port] python2: python -m SimpleHTTPServer [port] + +Elegant deduplication lines in file: + https://iridakos.com/how-to/2019/05/16/remove-duplicate-lines-preserving-order-linux.html + awk '!visited[$0]++' your_file > deduplicated_file + +Decode webp: + # from google's libwebp + # jpeg isn't supported, use convert after that + dwebp in.webp -o out.png + +Run studiotax on wine: + http://pnijjar.freeshell.org/2018/studiotax/ + WINEARCH=win32 + winetricks settings win7 # Might not be necessary + winetricks dlls dotnet45 ie6 + winetricks settings win7 + wine ./StudioTax2017Install.exe /extract + msiexec /i StudioTax.msi + +Fill dynamic XFA forms on linux: + Run Acrobat Reader DC 2019 on wine: + https://linuxconfig.org/how-to-install-latest-adobe-acrobat-reader-dc-on-ubuntu-18-04-bionic-beaver-linux-with-wine + https://www.quora.com/How-do-I-install-Adobe-Reader-on-Ubuntu-using-the-Wine-software + ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/ + WINEARCH=win32 + WINEPREFIX=~/.wine-32 + winetricks mspatcha + winetricks riched20 + winetricks allfonts # Maybe not ? + trizen -S ttf-windows # Indispensable, without it no text in UI + # maybe? winetricks atmlib wsh57 + winetricks settings win7 + wget ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/1901220034/AcroRdrDC1901220034_en_US.exe # Replace by latest version + wine ./AcroRdrDC1901220034_en_US.exe + wine ~/.wine-32/drive_c/Program\ Files/Adobe/Acrobat\ Reader\ DC/Reader/AcroRd32.exe + Select "Always open with Protected Mode Disabled" + Don't forget to kill the wineserver, adobe leaves a lot of garbage running: + wineserver --kill + Master PDF Editor (free version): + https://code-industry.net/free-pdf-editor/ + trizen -S masterpdfeditor + +Easily switch to russian phonetic keyboard: + setxkbmap fr,ru -variant ,phonetic -option grp:shift_caps_toggle + man xkeyboard-config # get list of possible toggles + +Image/photo sorting with feh: + feh --action1 'mv -v %F "/path/to/target/"%N' \ + --action[2-9] [...] /dir/to/sort + +Setup udev for android device with adb: + # Solves "adb: error: failed to get feature set: insufficient permissions for device" + # https://wiki.archlinux.org/index.php/Android_Debug_Bridge#Adding_udev_Rules + Get Vendor and and product IDs with + $ lsusb + /etc/udev/rules.d/51-android.rules: + SUBSYSTEM=="usb", ATTR{idVendor}=="[VENDOR ID]", MODE="0660", GROUP="adbusers" # Or sdkusers + SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_adb" + SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_fastboot" + $ sudo udevadm control --reload-rules + +Get original windows key from linux: + # From: https://twitter.com/BrandonPrry/status/1038269038881898498 + # Not guaranted to work + sudo cat /sys/firmware/acpi/tables/MSDM | tail -c 32 | xargs -0 echo + +Wayland install: + Qt issues: + sudo pacman -S qt5-wayland + export QT_QPA_PLATFORM="wayland" + +MSI ge62 webcam not found: + Activate using fn+F6 + +Air Canada PNR access: + https://services.aircanada.com/ServicingPNR/Ancillary/ACO/ + +Android diagnostic debug phone codes: + # https://www.itworld.com/article/2708985/debug-your-phone-with-these-hidden-android-secret-codes.html + # https://www.redmondpie.com/hidden-android-secret-codes-for-samsung-htc-motorola-sony-lg-and-other-devices/ + *#06# – IMEI number + *#0*# – Enter the service menu on newer phones like Galaxy S III + *#*#4636#*#* – Phone information, usage statistics and battery + *#*#34971539#*#* – Detailed camera information + *#*#273282*255*663282*#*#* – Immediate backup of all media files + *#*#197328640#*#* – Enable test mode for service + *#*#232339#*#* – Wireless LAN tests + *#*#0842#*#* – Backlight/vibration test + *#*#2664#*#* – Test the touchscreen + *#*#1111#*#* – FTA software version (1234 in the same code will give PDA and firmware version) + *#12580*369# – Software and hardware info + *#9090# – Diagnostic configuration + *#872564# – USB logging control + *#9900# – System dump mode + *#301279# – HSDPA/HSUPA Control Menu + *#7465625# – View phone lock status + *#*#7780#*#* – Reset the /data partition to factory state + *2767*3855# – Format device to factory state (will delete everything on phone) + ##7764726 – Hidden service menu for Motorola Droid + *#*#7594#*#* – Enable direct powering down of device once this code is entered + *#*#273283*255*663282*#*#* – Make a quick backup of all the media files on your Android device + *#*#232338#*#* – Shows Wi-Fi MAC address + *#*#1472365#*#* – Perform a quick GPS test + *#*#1575#*#* – For a more advanced GPS test + *#*#0283#*#* – Perform a packet loopback test + *#*#0*#*#* – Run an LCD display test + *#*#0289#*#* – Run Audio test + *#*#2663#*#* – Show device’s touch-screen version + *#*#0588#*#* – Perform a proximity sensor test + *#*#3264#*#* – Show RAM version + *#*#232331#*#* – Run Bluetooth test + *#*#232337#*# – Show device’s Bluetooth address + *#*#7262626#*#* – Perform a field test + *#*#8255#*#* – Monitor Google Talk service + *#*#4986*2650468#*#* – Show Phone, Hardware, PDA, RF Call Date firmware info + *#*#1234#*#* – Show PDA and Phone firmware info + *#*#2222#*#* – Show FTA Hardware version + *#*#44336#*#* – Show Build time and change list number + *#*#8351#*#* – Enable voice dialing log mode, dial *#*#8350#*#* to disable it + ##778 (+call) – Show EPST menu + These codes are specific to HTC devices only: + *#*#3424#*#* – Run HTC function test program + *#*#4636#*#* – Show HTC info menu + ##8626337# – Run VOCODER + ##33284# – Perform field test + *#*#8255#*#* – Launch Google Talk service monitor + ##3424# – Run diagnostic mode + ##3282# – Show EPST menu + ##786# – Reverse Logistics Support + +Android wpa_supplicant conf file path: + /data/misc/wifi/wpa_supplicant.conf + +Run GUI apps as root with sudo on Wayland: + # https://bugzilla.redhat.com/show_bug.cgi?id=1274451 + xhost +SI:localuser:root + sudo + xhost -SI:localuser:root # Clean up the security hole + +Fix Network Manager nm-applet/nmtui only working with root/sudo: + # /etc/polkit-1/rules.d/50-org.freedesktop.NetworkManager.rules + polkit.addRule(function(action, subject) { + if (action.id.indexOf("org.freedesktop.NetworkManager.") == 0 && subject.isInGroup("network")) { + return polkit.Result.YES; + } + }); + sudo usermod -aG network