Cleanup & consistency

This commit is contained in:
lhark 2021-08-27 20:17:58 +02:00
parent 49130de071
commit f2e0d8dd93

180
how_to
View file

@ -108,9 +108,8 @@ keyboard :
Nice environment : Nice environment :
cd ~ cd ~
git clone http://gitlab.rezometz.org/lhark/rc.git git clone http://gitlab.rezometz.org/lhark/rc.git
[git -C rc checkout v2]
rc/install.sh rc/install.sh
chsh -s </bin/zsh|/usr/bin/fish> chsh -s /bin/zsh
pacman : pacman :
-Syu Upgrade system -Syu Upgrade system
@ -256,32 +255,32 @@ PDF :
Filling the form: Filling the form:
pdftk form.pdf fill_form fields.fdf output filled_form.pdf pdftk form.pdf fill_form fields.fdf output filled_form.pdf
Generate a PDF quickly from Markdown: Generate a PDF quickly from Markdown:
# tectonic is pretty nice as a "it just works" latex compiler # tectonic is pretty nice as a "it just works" latex compiler
pandoc --pdf-engine=tectonic in.md -o out.pdf pandoc --pdf-engine=tectonic in.md -o out.pdf
Fill dynamic XFA forms on linux: Fill dynamic XFA forms on linux:
Run Acrobat Reader DC 2019 on wine: 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://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 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/ ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/
WINEARCH=win32 WINEARCH=win32
WINEPREFIX=~/.wine-32 WINEPREFIX=~/.wine-32
winetricks mspatcha winetricks mspatcha
winetricks riched20 winetricks riched20
winetricks allfonts # Maybe not ? winetricks allfonts # Maybe not ?
trizen -S ttf-windows # Indispensable, without it no text in UI trizen -S ttf-windows # Indispensable, without it no text in UI
# maybe? winetricks atmlib wsh57 # maybe? winetricks atmlib wsh57
winetricks settings win7 winetricks settings win7
wget ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/1901220034/AcroRdrDC1901220034_en_US.exe # Replace by latest version 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 ./AcroRdrDC1901220034_en_US.exe
wine ~/.wine-32/drive_c/Program\ Files/Adobe/Acrobat\ Reader\ DC/Reader/AcroRd32.exe wine ~/.wine-32/drive_c/Program\ Files/Adobe/Acrobat\ Reader\ DC/Reader/AcroRd32.exe
Select "Always open with Protected Mode Disabled" Select "Always open with Protected Mode Disabled"
Don't forget to kill the wineserver, adobe leaves a lot of garbage running: Don't forget to kill the wineserver, adobe leaves a lot of garbage running:
wineserver --kill wineserver --kill
Master PDF Editor (free version): Master PDF Editor (free version):
https://code-industry.net/free-pdf-editor/ https://code-industry.net/free-pdf-editor/
trizen -S masterpdfeditor trizen -S masterpdfeditor
D-Bus : D-Bus :
To reload service files /usr/share/dbus-1/services/ To reload service files /usr/share/dbus-1/services/
@ -465,17 +464,14 @@ Serial terminal
minicom -D /dev/ttyUSB0 -b <baud> minicom -D /dev/ttyUSB0 -b <baud>
Wifi AP: Wifi AP:
https://wiki.archlinux.org/index.php/Software_access_point # https://wiki.archlinux.org/index.php/Software_access_point
sudo pacman -S create_ap sudo pacman -S create_ap
https://github.com/oblique/create_ap/issues/107 # https://github.com/oblique/create_ap/issues/107
sed -i '/CHANNEL=$WIFI_IFACE_CHANNEL/d' /usr/bin/create_ap sed -i '/CHANNEL=$WIFI_IFACE_CHANNEL/d' /usr/bin/create_ap
Replace is_wifi_connected with: # Replace is_wifi_connected with:
is_wifi_connected() { return 1 } # is_wifi_connected() { return 1 }
sudo create_ap [-c <channel>] wlp2s0 wlp2s0 <ssid> <pwd> sudo create_ap [-c <channel>] wlp2s0 wlp2s0 <ssid> <pwd>
Sync from phone:
adb-sync -R /sdcard/<folder>/ <dest>
fail2ban unban: fail2ban unban:
Check if/where IP is banned Check if/where IP is banned
iptables -L -n | less iptables -L -n | less
@ -489,33 +485,6 @@ fail2ban unban:
# Remove leading "-A " # Remove leading "-A "
iptables -D <rule> iptables -D <rule>
Backup non rooted phone with adb:
adb backup -all -shared -obb -f <file>
need adb < 1.0.31
sometimes you might need to quote all arguments together
Root Samsung GT-S7275R "Ace 3" :
Use heimdall (cross platform equivalent to Samsung's Odin)
Install TWRP recovery:
Boot phone to download mode (Hold vol-down & home at boot)
Connect USB
$ heimdall flash --RECOVERY <recovery.img>
Keep vol-up & home pressed during reboot to go straight into recovery or img is overwritten by stock ROM
Flash CM13:
Use TWRP to Wipe system, data, dalvik & cache
$ adb push <cm13.zip> /sdcard
Use TWRP to flash CM13
Setup tips:
Activate dev mode by spamming Settings > About > Build
Enable USB debugging
Settings > Developer Options > Root Access
Sources:
https://forum.xda-developers.com/ace-3/development/recovery-t-r-p-samsung-galaxy-ace-3-lte-t2989278
https://web.archive.org/web/20160321062212/https://davideddu.org/blog/posts/how-to-flash-a-recovery-image-using-heimdall/
https://twrp.me/devices/samsunggalaxyace3.html
https://forum.xda-developers.com/ace-3/development/gt-s7275r-b-t-cyanogenmod-13-ace-3-lte-t3242054
https://forum.xda-developers.com/ace-3/development/gt-s7275r-b-t-cyanogenmod-14-samsung-t3468084
Nginx + uwsgi: Nginx + uwsgi:
$ pacman -S nginx (nginx-runit) uwsgi uwsgi-plugin-python $ pacman -S nginx (nginx-runit) uwsgi uwsgi-plugin-python
/etc/ /etc/
@ -572,25 +541,39 @@ Nginx + uwsgi:
runit: runit:
echo "exec uwsgi --ini /etc/uwsgi/emperor.ini --logto /var/log/uwsgi.log" > /etc/sv/uwsgi/run echo "exec uwsgi --ini /etc/uwsgi/emperor.ini --logto /var/log/uwsgi.log" > /etc/sv/uwsgi/run
Easy LaTeX compilation: LaTeX:
$ trizen -S tectonic Easy LaTeX compilation:
$ tectonic <file>.tex $ trizen -S tectonic
Should automatically resolve all dependencies $ tectonic <file>.tex
Also takes care of biblatex Should automatically resolve all dependencies
Uses Xetex to compile Also takes care of biblatex
Uses Xetex to compile
Subtle enby non-binary flag in latex:
# Thx @Scarlet
\newcommand\crule[3][black]{\textcolor{#1}{\rule{#2}{#3}}}
\definecolor{nb1}{RGB}{255,244,48}
\definecolor{nb2}{RGB}{220,220,220}
\definecolor{nb3}{RGB}{156,89,209}
\definecolor{nb4}{RGB}{0,0,0}
\begin{center}
\crule[nb1]{0.5cm}{0.1cm}
\crule[nb2]{0.5cm}{0.1cm}
\crule[nb3]{0.5cm}{0.1cm}
\crule[nb4]{0.5cm}{0.1cm}
\end{center}
Rename files from date of creation: Rename files from date of creation:
for f in *;do for f in *;do
mv "$f" "$(date "+IMG_%Y%m%d_%H%M%S.${f##*.}" -r "$f")" mv "$f" "$(date "+IMG_%Y%m%d_%H%M%S.${f##*.}" -r "$f")"
done done
Dans le cas d'android, utiliser tar -cf pour garder les timestamps In Android's case, use tar -cf to keep the timestamps
Deduplication de fichiers: file deduplication:
find ./ -type f -exec md5sum '{}' + | tee imgmd5 find ./ -type f -exec md5sum '{}' + | tee imgmd5
cat imgmd5| sort | uniq --check-chars=32 -d | cut --characters=35- | xargs rm cat imgmd5| sort | uniq --check-chars=32 -d | cut --characters=35- | xargs rm
# Pour le debug : | xargs feh -. # For debugging : | xargs feh -.
# Voir aussi la commande cmp, plus efficace qu'un calcul de hash dans certains cas # See also the `cmp` command, might be more efficient than a hash computation
Install and update YouCompleteMe on Arch: Install and update YouCompleteMe on Arch:
sudo pacman -S clang cmake sudo pacman -S clang cmake
@ -635,7 +618,7 @@ Compile C for ATmega328p/Arduino:
sudo usermod -aG dialout <user> # Or /dev/ttyACM0 group (might be uucp) sudo usermod -aG dialout <user> # Or /dev/ttyACM0 group (might be uucp)
avr-gcc -g -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o <name>.o <name>.c avr-gcc -g -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o <name>.o <name>.c
avr-gcc -mmcu=atmega328p <name>.o -o <name> avr-gcc -mmcu=atmega328p <name>.o -o <name>
avr-objcopy -O ihex -R .eeprom <name> <name>.hex avr-objcopy -O ihex -R .eeprom <name> <name>.hex
avrdude -F -V -c arduino -p ATMEGA328P -P /dev/ttyACM0 -b 115200 -U flash:w:<name>.hex avrdude -F -V -c arduino -p ATMEGA328P -P /dev/ttyACM0 -b 115200 -U flash:w:<name>.hex
@ -681,15 +664,15 @@ Get hardware informations:
dmidecode -t memory dmidecode -t memory
Others values are <bios|baseboard|chassis> Others values are <bios|baseboard|chassis>
Music fingerprinting Music fingerprinting:
# https://github.com/beetbox/pyacoustid # https://github.com/beetbox/pyacoustid
for f in *.mp3;do echo $f; python ~/src/pyacoustid/aidmatch.py $f;done > ident for f in *.mp3;do echo $f; python ~/src/pyacoustid/aidmatch.py $f;done > ident
awk '/\.mp3/{f = $0;next} f{printf "mv %s \"../%s.mp3\"\n", f, $0; f=0}' ident > rename.sh awk '/\.mp3/{f = $0;next} f{printf "mv %s \"../%s.mp3\"\n", f, $0; f=0}' ident > rename.sh
Echo to stderr Echo to stderr:
>&2 echo "message" >&2 echo "message"
Reset gpg-agent passphrase cache Reset gpg-agent passphrase cache:
Useful mainly for testing purposes Useful mainly for testing purposes
echo RELOADAGENT | gpg-connect-agent echo RELOADAGENT | gpg-connect-agent
@ -766,14 +749,19 @@ Android:
~/.android/avd/<your AVD name>.avd/config.ini ~/.android/avd/<your AVD name>.avd/config.ini
# If you have issues running image from different arch, try checking the PATH or # If you have issues running image from different arch, try checking the PATH or
# https://www.bram.us/2017/05/12/launching-the-android-emulator-from-the-command-line/ # https://www.bram.us/2017/05/12/launching-the-android-emulator-from-the-command-line/
emulator -avd <your AVD name> emulator -avd <your AVD name> [-camera-back <none|emulated|webcam0|virtualscene>]
# Other method, never tried: https://acavalin.com/p/android_emu
Android diagnostic debug phone codes: Android diagnostic debug phone codes:
# https://www.itworld.com/article/2708985/debug-your-phone-with-these-hidden-android-secret-codes.html # 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/ # https://www.redmondpie.com/hidden-android-secret-codes-for-samsung-htc-motorola-sony-lg-and-other-devices/
*#06# IMEI number
Confirmed working on Samsung Galaxy Ace 3:
*#06# IMEI number
*#*#4636#*#* Phone information, usage statistics and battery
*#0*# Enter the service menu on newer phones like Galaxy S III *#0*# Enter the service menu on newer phones like Galaxy S III
*#*#4636#*#* Phone information, usage statistics and battery
*#*#34971539#*#* Detailed camera information *#*#34971539#*#* Detailed camera information
*#*#273282*255*663282*#*#* Immediate backup of all media files *#*#273282*255*663282*#*#* Immediate backup of all media files
*#*#197328640#*#* Enable test mode for service *#*#197328640#*#* Enable test mode for service
@ -824,6 +812,40 @@ Android:
Android wpa_supplicant conf file path: Android wpa_supplicant conf file path:
/data/misc/wifi/wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf
Sync from phone:
adb-sync -R /sdcard/<folder>/ <dest>
Backup non rooted phone with adb:
adb backup -all -shared -obb -f <file>
need adb < 1.0.31
sometimes you might need to quote all arguments together
Root Samsung GT-S7275R "Ace 3" :
Use heimdall (cross platform equivalent to Samsung's Odin)
Install TWRP recovery:
Boot phone to download mode (Hold vol-down & home at boot)
Connect USB
$ heimdall flash --RECOVERY <recovery.img>
Keep vol-up & home pressed during reboot to go straight into recovery or img is overwritten by stock ROM
Flash CM13:
Use TWRP to Wipe system, data, dalvik & cache
$ adb push <cm13.zip> /sdcard
Use TWRP to flash CM13
Setup tips:
Activate dev mode by spamming Settings > About > Build
Enable USB debugging
Settings > Developer Options > Root Access
Sources:
https://forum.xda-developers.com/ace-3/development/recovery-t-r-p-samsung-galaxy-ace-3-lte-t2989278
https://web.archive.org/web/20160321062212/https://davideddu.org/blog/posts/how-to-flash-a-recovery-image-using-heimdall/
https://twrp.me/devices/samsunggalaxyace3.html
https://forum.xda-developers.com/ace-3/development/gt-s7275r-b-t-cyanogenmod-13-ace-3-lte-t3242054
https://forum.xda-developers.com/ace-3/development/gt-s7275r-b-t-cyanogenmod-14-samsung-t3468084
Update Emojis on old androids:
# https://toot.party/@SigmaOne/106159205703917847
Custom NotoColorEmoji.ttf in /system/fonts/
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
@ -944,7 +966,7 @@ Limit bandwidth, download/upload speed of process:
XferCommand = /usr/bin/wget --limit-rate 100K --passive-ftp -c -O %o %u XferCommand = /usr/bin/wget --limit-rate 100K --passive-ftp -c -O %o %u
Qutebrowser Qutebrowser
Adblocking: Adblocking (obsolete, now builtin):
https://gitlab.com/jgkamat/jblock https://gitlab.com/jgkamat/jblock
Config: Config:
:set auto-save.session true :set auto-save.session true