Add a truckload of new tidbits

This commit is contained in:
lhark 2019-10-03 12:36:28 -04:00
parent 959809e07e
commit 3c4cfc5b56

177
how_to
View file

@ -127,9 +127,13 @@ PDF :
AUR -> pdftk : AUR -> pdftk :
Merge pdf : Merge pdf :
pdftk input1.pdf input2.pdf input3.pdf cat output output.pdf pdftk input1.pdf input2.pdf input3.pdf cat output output.pdf
Extract pages : Extract pages :
pdftk input.pdf cat <range> output out.pdf pdftk input.pdf cat <range> output out.pdf
# range can be <start>-<end>, more info at pdftk --help # range can be <start>-<end>, 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 : D-Bus :
To reload service files /usr/share/dbus-1/services/ To reload service files /usr/share/dbus-1/services/
@ -163,7 +167,7 @@ Drag & drop files:
Fix hardware clock (with chrony): Fix hardware clock (with chrony):
sudo chronyc sudo chronyc
makestep makestep
trimrtc trimrtc
quit quit
Alternative to trimrtc: Alternative to trimrtc:
sudo hwclock --systohc sudo hwclock --systohc
@ -183,6 +187,8 @@ Use scanner from command line
If invalid argument: If invalid argument:
scanimage -L scanimage -L
scanimage --device <device> ... scanimage --device <device> ...
For HP network hardware, use hplip's:
hp-makeuri <ip> | grep "SANE URI:"
Example to scan US letter in good quality Example to scan US letter in good quality
scanimage --device "plop" --resolution 300 --format jpeg -y 280 --mode Color > whatevs.jpg 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 ffmpeg -i in.mp4 -an out.mp4
Nvidia hardware encoding Nvidia hardware encoding
optirun ffmpeg -i in.mp4 -c:v h264_nvenc -crf 23 out.mp4 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: RE .net apps:
ilspymono <list-of-deps.txt>(can be empty) <exe or dll to disassemble> <output dir> ilspymono <list-of-deps.txt>(can be empty) <exe or dll to disassemble> <output dir>
@ -226,7 +235,7 @@ Mount as user:
Borg backup: Borg backup:
borg init --encryption=repokey-blake2 </repo> borg init --encryption=repokey-blake2 </repo>
borg create -v --stats --progress --compression zlib /mnt/<machine>/home/::{now} /home/<user> borg create -v --stats --progress --compression zlib "/mnt/<machine>/home/::{now}" /home/<user>
borg list </repo> borg list </repo>
borg check --verify-data --progress </repo> borg check --verify-data --progress </repo>
borg mount </repo> </mount> borg mount </repo> </mount>
@ -352,6 +361,8 @@ Easy LaTeX compilation:
$ trizen -S tectonic $ trizen -S tectonic
$ tectonic <file>.tex $ tectonic <file>.tex
Should automatically resolve all dependencies Should automatically resolve all dependencies
Also takes care of biblatex
Uses Xetex to compile
Rename files from date of creation: Rename files from date of creation:
for f in *;do for f in *;do
@ -497,9 +508,16 @@ Uncompress android .ab backup files:
Fix: Failed to activate service 'org.freedesktop.login1': timed out: Fix: Failed to activate service 'org.freedesktop.login1': timed out:
If dbus has been restarted, don't forget to restart elogind/systemd-logind If dbus has been restarted, don't forget to restart elogind/systemd-logind
Artilinux steam lib32-systemd fix: Artix:
https://forum.artixlinux.org/index.php/topic,633.msg7437.html Artixlinux pacman gpg unknown trust fix:
[Attached file]: resources/lib32-systemd-dummy.pkgbuild 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: LibreOffice unlock write-protected doc:
Format -> Sections... -> [Uncheck Protect in "Write protection"] Format -> Sections... -> [Uncheck Protect in "Write protection"]
@ -530,3 +548,150 @@ Simple python HTTP server:
python -m http.server [port] python -m http.server [port]
python2: python2:
python -m SimpleHTTPServer [port] 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 devices touch-screen version
*#*#0588#*#* Perform a proximity sensor test
*#*#3264#*#* Show RAM version
*#*#232331#*#* Run Bluetooth test
*#*#232337#*# Show devices 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 <gui>
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 <user>