Compare commits
13 commits
9467bb5513
...
412ee1d52b
Author | SHA1 | Date | |
---|---|---|---|
412ee1d52b | |||
ff52318032 | |||
4b963e97d7 | |||
037cf084be | |||
fa398015d5 | |||
10a8b4c991 | |||
ace145a64d | |||
f2e0d8dd93 | |||
49130de071 | |||
25879199d7 | |||
66114985a0 | |||
341e713f8a | |||
1e4745e76f |
487
how_to
487
how_to
|
@ -31,6 +31,8 @@ Usefull packages :
|
||||||
lnav
|
lnav
|
||||||
Backlight management:
|
Backlight management:
|
||||||
light # http://haikarainen.github.io/light/
|
light # http://haikarainen.github.io/light/
|
||||||
|
IRC:
|
||||||
|
catgirl # https://git.causal.agency/catgirl
|
||||||
|
|
||||||
System setup:
|
System setup:
|
||||||
display/drivers:
|
display/drivers:
|
||||||
|
@ -106,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
|
||||||
|
@ -117,7 +118,9 @@ pacman :
|
||||||
-Sc Clean packages cache
|
-Sc Clean packages cache
|
||||||
-Rns <> Remove program, its unused dependencies, and config files
|
-Rns <> Remove program, its unused dependencies, and config files
|
||||||
-Qi <> Package information
|
-Qi <> Package information
|
||||||
-Fo <file> Which package the file belongs to
|
-Ql <> List files owned by package
|
||||||
|
-Qo <file> Which package the file belongs to
|
||||||
|
-Qs <> Search install packages
|
||||||
Recover installed packages from /var/log/pacman.log
|
Recover installed packages from /var/log/pacman.log
|
||||||
(awk '$3 ~ /installed/{print $4}' /var/log/pacman.log | sort | uniq; sed -En 's@.*/home/lhark/aur/(.*)/.*@\1@p' /var/log/pacman.log) | sort | uniq -u > package-list
|
(awk '$3 ~ /installed/{print $4}' /var/log/pacman.log | sort | uniq; sed -En 's@.*/home/lhark/aur/(.*)/.*@\1@p' /var/log/pacman.log) | sort | uniq -u > package-list
|
||||||
|
|
||||||
|
@ -231,6 +234,9 @@ PDF :
|
||||||
convert [jpg|png|txt|pdf|...] output.pdf
|
convert [jpg|png|txt|pdf|...] output.pdf
|
||||||
# Might need to tweak /etc/ImageMagick-7/policy.xml
|
# Might need to tweak /etc/ImageMagick-7/policy.xml
|
||||||
# https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion
|
# https://stackoverflow.com/questions/52998331/imagemagick-security-policy-pdf-blocking-conversion
|
||||||
|
Create pdf from images losslessly:
|
||||||
|
pacman -S img2pdf
|
||||||
|
img2pdf -o <out.pdf> <in1.jpg..inN.jpg>
|
||||||
Fill form & annotate:
|
Fill form & annotate:
|
||||||
For well formatted interactive forms:
|
For well formatted interactive forms:
|
||||||
evince
|
evince
|
||||||
|
@ -242,6 +248,7 @@ PDF :
|
||||||
inkscape
|
inkscape
|
||||||
Batch mode with pdftk:
|
Batch mode with pdftk:
|
||||||
# http://www.myown1.com/linux/pdf_formfill.shtml
|
# http://www.myown1.com/linux/pdf_formfill.shtml
|
||||||
|
# https://blog.nemirwen.me/posts/batch-pdf-form-filling
|
||||||
Finding the fields:
|
Finding the fields:
|
||||||
# pdftk needs java-commons-lang
|
# pdftk needs java-commons-lang
|
||||||
pdftk form.pdf dump_data_fields_utf8 > fields.flds
|
pdftk form.pdf dump_data_fields_utf8 > fields.flds
|
||||||
|
@ -254,32 +261,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/
|
||||||
|
@ -306,6 +313,8 @@ Wallpapers :
|
||||||
center selection
|
center selection
|
||||||
etc.
|
etc.
|
||||||
|
|
||||||
|
Or use https://github.com/aearil/dustr in a loop
|
||||||
|
|
||||||
|
|
||||||
Drag & drop files:
|
Drag & drop files:
|
||||||
dragon : https://github.com/mwh/dragon
|
dragon : https://github.com/mwh/dragon
|
||||||
|
@ -341,6 +350,9 @@ Network Manager:
|
||||||
Under IPv4:
|
Under IPv4:
|
||||||
select Shared
|
select Shared
|
||||||
|
|
||||||
|
Chrony integration:
|
||||||
|
trizen -S https://aur.archlinux.org/networkmanager-dispatcher-chrony.git/
|
||||||
|
|
||||||
Power saving :
|
Power saving :
|
||||||
echo "vm.dirty_writeback_centisecs = 6000" >> /etc/sysctl.d/dirty.conf
|
echo "vm.dirty_writeback_centisecs = 6000" >> /etc/sysctl.d/dirty.conf
|
||||||
echo "vm.laptop_mode = 5" >> /etc/sysctl.d/laptop.conf
|
echo "vm.laptop_mode = 5" >> /etc/sysctl.d/laptop.conf
|
||||||
|
@ -459,19 +471,18 @@ Borg backup:
|
||||||
|
|
||||||
Serial terminal
|
Serial terminal
|
||||||
st -l /dev/ttyUSB0 <baud>
|
st -l /dev/ttyUSB0 <baud>
|
||||||
|
# Or
|
||||||
|
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
|
||||||
|
@ -485,33 +496,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/
|
||||||
|
@ -568,25 +552,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
|
||||||
|
@ -627,10 +625,11 @@ Install 64 bits kernel on 32 bits system (and 64 bits hardware) (bad idea)
|
||||||
|
|
||||||
Compile C for ATmega328p/Arduino:
|
Compile C for ATmega328p/Arduino:
|
||||||
sudo xbps-install -S avr-gcc avr-libc avrdude
|
sudo xbps-install -S avr-gcc avr-libc avrdude
|
||||||
sudo usermod -aG dialout <user> # Or /dev/ttyACM0 group
|
sudo pacman -S avr-libc avrdude
|
||||||
|
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
|
||||||
|
|
||||||
|
@ -676,15 +675,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
|
||||||
|
|
||||||
|
@ -703,9 +702,160 @@ Better Bibtex, Zotero:
|
||||||
Bumblebee runit fix:
|
Bumblebee runit fix:
|
||||||
sed -i 's/Driver=$/Driver=nvidia/' /etc/bumblebee/bumblebee.conf
|
sed -i 's/Driver=$/Driver=nvidia/' /etc/bumblebee/bumblebee.conf
|
||||||
|
|
||||||
Uncompress android .ab backup files:
|
Runit logging:
|
||||||
# https://stackoverflow.com/questions/18533567/how-to-extract-or-unpack-an-ab-file-android-backup-file
|
socklog
|
||||||
( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar xfvz -
|
* syslogd replacement
|
||||||
|
* gets messages sent via syslog() (into /dev/log)
|
||||||
|
svlogd
|
||||||
|
* builtin log rotation
|
||||||
|
* needs to be setup for each service (/etc/runit/sv/<service>/log/run)
|
||||||
|
`exec chpst -u log svlogd -tt /var/log/<service>`
|
||||||
|
$ sudo mkdir /var/log/<service>
|
||||||
|
$ sudo chown -R :log /var/log/<service>
|
||||||
|
$ sudo chmod g+w /var/log/<service>
|
||||||
|
runsvdir
|
||||||
|
* sends its stdout to /dev/console
|
||||||
|
* sends its stderr to its own command line (ps aux | grep runsvdir)
|
||||||
|
runsv
|
||||||
|
* if <service>/log exists, redirects service's stdout to logger's stdin
|
||||||
|
* by default, runsv's stderr, stdout (and stdin?) are redirected to /dev/console
|
||||||
|
Android:
|
||||||
|
Uncompress android .ab backup files:
|
||||||
|
# https://stackoverflow.com/questions/18533567/how-to-extract-or-unpack-an-ab-file-android-backup-file
|
||||||
|
( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar xfvz -
|
||||||
|
|
||||||
|
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
|
||||||
|
Bus 001 Device 007: ID 0fce:8161 Sony Ericsson Mobile Communications AB ST18i
|
||||||
|
^ ^
|
||||||
|
/ \
|
||||||
|
Vendor ID Product ID
|
||||||
|
Create adbusers group and yourself to it
|
||||||
|
$ sudo groupadd adbusers
|
||||||
|
$ sudo usermod -aG adbusers <user>
|
||||||
|
/etc/udev/rules.d/51-android.rules:
|
||||||
|
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>", MODE="0660", GROUP="adbusers" # Or sdkusers
|
||||||
|
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>",ATTR{idProduct}=="<your product id>",SYMLINK+="android_adb"
|
||||||
|
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>",ATTR{idProduct}=="<your product id>",SYMLINK+="android_fastboot"
|
||||||
|
$ sudo udevadm control --reload-rules
|
||||||
|
|
||||||
|
Setup android emulator:
|
||||||
|
trizen -S android-emulator \
|
||||||
|
android-google-apis-x86-system-image-23 \
|
||||||
|
android-sdk-cmdline-tools-latest # Some tools are borked in the original package
|
||||||
|
source /etc/profile # Update PATH
|
||||||
|
# avdmanager will complain about permissions at first start but will
|
||||||
|
# happily put AVDs in /root/.android/avd if you let it have it for too long
|
||||||
|
/opt/android-sdk/cmdline-tools/latest/bin/avdmanager create avd \
|
||||||
|
--force \
|
||||||
|
--name <your AVD name> \
|
||||||
|
--package 'system-images;android-23;google_apis;x86' # Match path in /opt/android-sdk/system-images/
|
||||||
|
# AVD is stored in ~/.android/avd/
|
||||||
|
# Enable using the hardware keyboard, and switch layout to azerty
|
||||||
|
sed -i -e 's/\(hw.keyboard=\).*/\1yes/' \
|
||||||
|
-e 's/\(hw.keyboard.charmap=\).*/\1azerty/' \
|
||||||
|
~/.android/avd/<your AVD name>.avd/config.ini
|
||||||
|
# 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/
|
||||||
|
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:
|
||||||
|
# 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/
|
||||||
|
|
||||||
|
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
|
||||||
|
*#*#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
|
||||||
|
|
||||||
|
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
|
||||||
|
@ -731,6 +881,8 @@ Euro truck simulator 2:
|
||||||
Run ETS2Studio under wine
|
Run ETS2Studio under wine
|
||||||
winetricks dotnet45
|
winetricks dotnet45
|
||||||
Confirmed to work on a 32 bits prefix, untested on 64
|
Confirmed to work on a 32 bits prefix, untested on 64
|
||||||
|
To run TruckersMP on linux:
|
||||||
|
https://github.com/truckersmp-cli/truckersmp-cli
|
||||||
|
|
||||||
ssh:
|
ssh:
|
||||||
get machine fingerprints:
|
get machine fingerprints:
|
||||||
|
@ -744,6 +896,23 @@ ssh:
|
||||||
ssh-keygen -t ed25519 -a 100
|
ssh-keygen -t ed25519 -a 100
|
||||||
Good ol' RSA, with 4096 bits for good measure
|
Good ol' RSA, with 4096 bits for good measure
|
||||||
ssh-keygen -t rsa -b 4096 -o -a 100
|
ssh-keygen -t rsa -b 4096 -o -a 100
|
||||||
|
Restricted access for backups:
|
||||||
|
Create system user with no password, give it a HOME and a group (or use a backup group)
|
||||||
|
Prepend key in .ssh/authorized_keys with
|
||||||
|
command="scp -f /path/to/<file|wildcard>",no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding ssh-rsa AAAAB[...]
|
||||||
|
Setup rssh
|
||||||
|
pacman -S rssh
|
||||||
|
# Access bits order: rsync, rdist, cvs, sftp, scp, svnserve
|
||||||
|
echo "user=<backup user>:<umask>:000010:" >> /etc/rssh.conf
|
||||||
|
sudo chsh -s /usr/bin/rssh <backup user>
|
||||||
|
Fix key auth:
|
||||||
|
chmod 700 ~/.ssh/
|
||||||
|
chmod 600 ~/.ssh/authorized_keys
|
||||||
|
Allow connections from behind a NAT:
|
||||||
|
from NAT-ed machine:
|
||||||
|
ssh -R 2222:localhost:22 <user>@<server>
|
||||||
|
from server:
|
||||||
|
ssh -p 2222 <user>@127.0.0.1
|
||||||
|
|
||||||
Run MSVC on linux with Wine:
|
Run MSVC on linux with Wine:
|
||||||
As seen on the internet, not tested:
|
As seen on the internet, not tested:
|
||||||
|
@ -780,24 +949,6 @@ Image/photo sorting with feh:
|
||||||
feh --action1 'mv -v %F "/path/to/target/"%N' \
|
feh --action1 'mv -v %F "/path/to/target/"%N' \
|
||||||
--action[2-9] [...] /dir/to/sort
|
--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
|
|
||||||
Bus 001 Device 007: ID 0fce:8161 Sony Ericsson Mobile Communications AB ST18i
|
|
||||||
^ ^
|
|
||||||
/ \
|
|
||||||
Vendor ID Product ID
|
|
||||||
Create adbusers group and yourself to it
|
|
||||||
$ sudo groupadd adbusers
|
|
||||||
$ sudo usermod -aG adbusers <user>
|
|
||||||
/etc/udev/rules.d/51-android.rules:
|
|
||||||
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>", MODE="0660", GROUP="adbusers" # Or sdkusers
|
|
||||||
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>",ATTR{idProduct}=="<your product id>",SYMLINK+="android_adb"
|
|
||||||
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>",ATTR{idProduct}=="<your product id>",SYMLINK+="android_fastboot"
|
|
||||||
$ sudo udevadm control --reload-rules
|
|
||||||
|
|
||||||
Get original windows key from linux:
|
Get original windows key from linux:
|
||||||
# From: https://twitter.com/BrandonPrry/status/1038269038881898498
|
# From: https://twitter.com/BrandonPrry/status/1038269038881898498
|
||||||
# Not guaranted to work
|
# Not guaranted to work
|
||||||
|
@ -819,62 +970,6 @@ MSI ge62 webcam not found:
|
||||||
Air Canada PNR access:
|
Air Canada PNR access:
|
||||||
https://services.aircanada.com/ServicingPNR/Ancillary/ACO/
|
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
|
|
||||||
|
|
||||||
Grub2 theme customization:
|
Grub2 theme customization:
|
||||||
theme.txt reference:
|
theme.txt reference:
|
||||||
http://wiki.rosalab.ru/en/index.php/Grub2_theme_/_reference#Main_file_syntax
|
http://wiki.rosalab.ru/en/index.php/Grub2_theme_/_reference#Main_file_syntax
|
||||||
|
@ -889,7 +984,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
|
||||||
|
@ -997,9 +1092,12 @@ Check for available package updates with Arch/Artix:
|
||||||
sudo pacman -S pacman-contrib
|
sudo pacman -S pacman-contrib
|
||||||
checkupdates
|
checkupdates
|
||||||
|
|
||||||
Git push and pull using different URL/protocols:
|
Git:
|
||||||
# https://www.scivision.dev/git-pull-https-push-ssh/
|
Git push and pull using different URL/protocols:
|
||||||
git config url."git@example.org:user/".pushInsteadOf "https://example.org/user/"
|
# https://www.scivision.dev/git-pull-https-push-ssh/
|
||||||
|
git config url."git@example.org:user/".pushInsteadOf "https://example.org/user/"
|
||||||
|
Prevent git from trying to auto-detect user name and email:
|
||||||
|
user.useConfigOnly = true
|
||||||
|
|
||||||
Setup a midi synth:
|
Setup a midi synth:
|
||||||
# http://www.tedfelix.com/linux/linux-midi.html
|
# http://www.tedfelix.com/linux/linux-midi.html
|
||||||
|
@ -1061,3 +1159,76 @@ GPG:
|
||||||
|
|
||||||
Windows use realtime clock as UTC:
|
Windows use realtime clock as UTC:
|
||||||
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversal = QWORD 0x01
|
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversal = QWORD 0x01
|
||||||
|
|
||||||
|
sway / wayland:
|
||||||
|
Get current active (first) keyboard layout name:
|
||||||
|
# https://queer.hacktivis.me/objects/73823f56-1954-44fe-b046-39e726cca67b
|
||||||
|
swaymsg -t get_inputs | jq 'map(select(.type == "keyboard"))[0].xkb_active_layout_name'
|
||||||
|
|
||||||
|
Bluetooth:
|
||||||
|
Get access to deprecated gatttool, hcitool or sdptool:
|
||||||
|
trizen -S bluez-utils-compat
|
||||||
|
Add `--disable-systemd` to ./configure command on Artix
|
||||||
|
Setup new device with bluetoothctl:
|
||||||
|
# https://wiki.archlinux.org/title/Bluetooth#Pairing
|
||||||
|
bluetoothctl
|
||||||
|
[bluetooth]# power on
|
||||||
|
[bluetooth]# scan on
|
||||||
|
[bluetooth]# pair <MAC>
|
||||||
|
Fix `Failed to connect: org.bluez.Error.Failed`:
|
||||||
|
# In my case it was apparently pulseaudio's fault oO
|
||||||
|
sudo pacman -S pulseaudio-bluetooth
|
||||||
|
pactl load-module module-bluetooth-discover
|
||||||
|
Send files (WIP, still not working here):
|
||||||
|
# https://www.garron.me/en/go2linux/how-transfer-files-bluetooth-linux.html
|
||||||
|
# https://wiki.archlinux.org/title/ObexFTP
|
||||||
|
OBEX Object Push method:
|
||||||
|
trizen -S obexftp
|
||||||
|
sdptool search --bdaddr 00:18:31:12:3A:3F OPUSH | grep -i channel
|
||||||
|
# `--nopath --noconn --uuid none` result in making an Obex Push request
|
||||||
|
obexftp --nopath --noconn --uuid none --bluetooth <MAC> --channel <CHANNEL> --put <FILE>
|
||||||
|
OBEX File Transfer method:
|
||||||
|
trizen -S obexftp
|
||||||
|
sdptool search --bdaddr 00:18:31:12:3A:3F FTP | grep -i channel
|
||||||
|
# `--channel` (and so sdptool search) might be superfluous (autodetect?)
|
||||||
|
obexftp --bluetooth <MAC> --channel <CHANNEL> --put <FILE>
|
||||||
|
Blueman method:
|
||||||
|
sudo pacman -S blueman
|
||||||
|
blueman-sendto --device=<MAC> <FILE>
|
||||||
|
# Also, for the GUI:
|
||||||
|
blueman-manager
|
||||||
|
ussp-push method:
|
||||||
|
trizen -S ussp-push
|
||||||
|
ussp-push <MAC> <LOCAL FILE> <REMOTE FILE NAME>
|
||||||
|
Receive files:
|
||||||
|
# https://gitlab.com/obexpushd/mainline
|
||||||
|
# Not even packaged on the AUR for now
|
||||||
|
Bluetooth tools recap' (2007):
|
||||||
|
# https://hanishkvc.wordpress.com/2007/05/16/short-and-simple-commandline-bluetooth-in-any-new-linux-distros/
|
||||||
|
|
||||||
|
Extract debian .deb package:
|
||||||
|
ar x <package>.deb
|
||||||
|
tar xf data.tar.xz
|
||||||
|
|
||||||
|
Convert docx to text format in CLI:
|
||||||
|
# Better fidelity wrt. the document layout
|
||||||
|
docx2txt <name>.docx
|
||||||
|
# Can output markdown
|
||||||
|
pandoc <name>.docx -o <name>.md
|
||||||
|
|
||||||
|
Flash BIOS using CH341A and SOP8 clip:
|
||||||
|
Hardware setup:
|
||||||
|
/!\ Don't connect USB before everything else is plugged-in correctly
|
||||||
|
/!\ Remove all source of alimentation from the target board (power jack AND battery)
|
||||||
|
Connect clip to EEPROM: red wire is pin 1
|
||||||
|
Connect clip to CH341A: use the SPI/BIOS side of the programmer
|
||||||
|
Reading firmware:
|
||||||
|
sudo pacman -S flashrom
|
||||||
|
# Flashrom list of supported chips: https://www.flashrom.org/Supported_hardware
|
||||||
|
# https://wiki.archlinux.org/title/Flashing_BIOS_from_Linux#Flashrom
|
||||||
|
sudo flashrom --programmer ch341a_spi -r backup1.bin
|
||||||
|
sudo flashrom --programmer ch341a_spi -r backup2.bin
|
||||||
|
# Check we got a correct read
|
||||||
|
cmp backup1.bin backup2.bin
|
||||||
|
Flashing firmware:
|
||||||
|
sudo flashrom --programmer ch341a_spi -w <new_firmware.bin>
|
||||||
|
|
|
@ -6,6 +6,7 @@ NORMAL MODE
|
||||||
<C-W>[HJKL] Move split to extreme left, bottom, top, right
|
<C-W>[HJKL] Move split to extreme left, bottom, top, right
|
||||||
c% Replace argument with arbitrary nested paren/brackets/etc...
|
c% Replace argument with arbitrary nested paren/brackets/etc...
|
||||||
https://thepugautomatic.com/2014/03/vims-life-changing-c-percent/
|
https://thepugautomatic.com/2014/03/vims-life-changing-c-percent/
|
||||||
|
g<C-G> count words
|
||||||
|
|
||||||
VISUAL MODE
|
VISUAL MODE
|
||||||
<C-V>g<C-A/X> Convert column of identical number to inc/decrementing list
|
<C-V>g<C-A/X> Convert column of identical number to inc/decrementing list
|
||||||
|
|
Loading…
Reference in a new issue