Usefull packages : zsh vim git Image viewing : feh sixv Suckless image viewer Monitoring : htop glances System overview (top, disk, mem, ...) ncdu Disk usage Terminal : kitty GPU accelerated term, nicely configurable st Simple Terminal, very light Desktop environment : dwm Dynamic Window Manager dmenu Office : sent Simple slides tool Misc : eg Examples of common tools usage (think find or tar) keyboard : console: /etc/vconsole.conf X11: sudo localectl set-x11-keymap fr Nice environment : cd ~ git clone http://gitlab.rezometz.org/lhark/rc.git rc/install.sh chsh -s /bin/zsh pacman : -Syu Upgrade system -S <> Install software -Ss <> Search repositories -Sc Clean packages cache -Rns <> Remove program, its unused dependencies, and config files -Qi <> Package information -Fo Which package the file belongs to ABS : (Arch Build System) pacman -S abs mkdir ~/abs cp -r /var/abs/ ~/abs xorg : install : xorg-server xorg-xinit lspci | grep -e VGA -e 3D xorg-xf86- config : cp /etc/X11/xinit/xinitrc ~ delete xterm crap echo "exec dwm" >> ~/xinitrc echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx' >> ~/.zprofile dwm : with ABS community/dwm config : ~/abs/dwm/config.h fix azerty bindings : XK_0 -> XK_agrave XK_1 -> XK_ampersand XK_2 -> XK_eacute XK_3 -> XK_quotedbl XK_4 -> XK_apostrophe XK_5 -> XK_parenleft XK_6 -> XK_minus XK_7 -> XK_egrave XK_8 -> XK_underscore XK_9 -> XK_ccedilla easy recompile : alias redwm='cd ~/abs/dwm; updpkgsums; makepkg -fi --noconfirm; killall dwm' synaptics : cp /usr/share/X11/xorg.conf.d/50-synaptics.conf /etc/X11 usefull options : Option "TapButton1" "1" Option "TapButton2" "2" Option "TapButton3" "3" Option "AccelFactor" "0.0" Option "MaxSpeed" "1.0" Option "MinSpeed" "1.0" st : with ABS (arch) https://wiki.archlinux.org/index.php/Patching_in_ABS http://st.suckless.org/patches/solarized http://dwm.suckless.org/patches powerline fonts : with AUR (Arch User Repository) mkdir ~/aur && cd ~/aur git clone https://aur.archlinux.org/powerline-fonts-git.git cd powerline-fonts-git && makepkg -sri vim ~/abs/st/config.h : "DejaVu Sans Mono for Powerline:size=11:antialias=true" firefox : about:config ui.key.menuAccessKeyFocuses -> false # disable Alt shenanigans browser.backspace_action -> 0 # Enable backspace previous page MTP : with AUR : trizen -S simple-mtpfs usage : simple-mtpfs --list-devices simple-mtpfs ~/mnt (mount) simple-mtpfs --device ~/mnt fusermount -u ~/mnt (umount) PDF : AUR -> pdftk : Merge pdf : pdftk input1.pdf input2.pdf input3.pdf cat output output.pdf Extract pages : pdftk input.pdf cat output out.pdf # range can be -, more info at pdftk --help D-Bus : To reload service files /usr/share/dbus-1/services/ sudo systemctl reload dbus Notifications : grep -l 'org.freedesktop.Notifications' /usr/share/dbus-1/services/* change "Exec=" ACPI GTX960M bug: https://bugzilla.kernel.org/show_bug.cgi?id=156341 https://github.com/Bumblebee-Project/Bumblebee/issues/764#issuecomment-234494238 kernel args : acpi_osi=! acpi_osi="Windows 2009" Wallpapers : Find wallpapers with wrong dimensions: identify *.{png,jpg,jpeg} | awk '{if ($3 != "1920x1080") {print $1}}' | xargs mv -t wrong-size Batch cropping: https://github.com/pknowles/cropall ./cropall.py to save current in /crops/ and show next Output size is set in source file Would be nice to add a few keybinds moving selection around (vim style :) center selection etc. Drag & drop files: dragon : https://github.com/mwh/dragon Fix hardware clock (with chrony): sudo chronyc makestep trimrtc quit Alternative to trimrtc: sudo hwclock --systohc Network Manager: nmtui : add/edit connections nmcli : informations Power saving : echo "vm.dirty_writeback_centisecs = 6000" >> /etc/sysctl.d/dirty.conf echo "vm.laptop_mode = 5" >> /etc/sysctl.d/laptop.conf Use scanner from command line sudo pacman -S sane scanimage >result --mode=Color for better quality If invalid argument: scanimage -L scanimage --device ... Example to scan US letter in good quality scanimage --device "plop" --resolution 300 --format jpeg -y 280 --mode Color > whatevs.jpg Remote presentation tool: ssh slides-machine while read -r; do DISPLAY=:0 xdotool getactivewindow key space; done # Just press space to get the next slide # Perfect with an android phone Suckless sent: color scheme: fg = #80b31a bg = #082a3a Font: Hack Video and audio editing: Cut video/audio: ffmpeg -ss "start" [-t "duration"|-to "end"] -i input.mp3 -acodec copy output.mp3 Remove audio from video file ffmpeg -i in.mp4 -an out.mp4 Nvidia hardware encoding optirun ffmpeg -i in.mp4 -c:v h264_nvenc -crf 23 out.mp4 RE .net apps: ilspymono (can be empty) Wireshark proprement: sudo gpasswd -a wireshark sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip CAP_DAC_OVERRIDE+eip' /usr/bin/dumpcap MAC spoofing: sudo ip link set dev down sudo ip link set dev address sudo ip link set dev up Mount as user: /!\ on filesystems with permissions, it is permanent sudo mount /dev/sd[a-z][0-9] /mnt sudo chown /mnt Borg backup: borg init --encryption=repokey-blake2 borg create -v --stats --progress --compression zlib /mnt//home/::{now} /home/ borg list borg check --verify-data --progress borg mount borg prune -v --list --keep-daily=7 --keep-weekly=4 --keep-monthly=6 Serial terminal st -l /dev/ttyUSB0 Wifi AP: https://wiki.archlinux.org/index.php/Software_access_point sudo pacman -S create_ap https://github.com/oblique/create_ap/issues/107 sed -i '/CHANNEL=$WIFI_IFACE_CHANNEL/d' /usr/bin/create_ap Replace is_wifi_connected with: is_wifi_connected() { return 1 } sudo create_ap [-c ] wlp2s0 wlp2s0 PDF fill form & annotate: For well formatted interactive forms: evince For non-interactive PDF: xournal libreoffice Draw inkscape Sync from phone: adb-sync -R /sdcard// fail2ban unban: Check if/where IP is banned iptables -L -n | less / With Fail2Ban before v0.8.8: fail2ban-client get YOURJAILNAMEHERE actionunban IPADDRESSHERE With Fail2Ban v0.8.8 and later: fail2ban-client set YOURJAILNAMEHERE unbanip IPADDRESSHERE When all else fail (/!\ Careful with this one /!\): iptables -S | grep # Remove leading "-A " iptables -D Pretty log pager: lnav Backup non rooted phone with adb: adb backup -all -shared -obb -f 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 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 /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: /etc/ nginx/ nginx.conf uwsgi_params uwsgi/ vassals/ yoursite.ini /var/ www/ .virtualenvs/ yourvirtualenv/ yoursite/ /tmp/ yoursite.sock Create www-data useradd -r -s /usr/bin/nologin -U www-data Setup uwsgi daemon with cmd : uwsgi --emperor /etc/uwsgi/vassals --uid www-data --gid www-data nginx.conf: user www-data www-data; server { listen 80; root /var/www/yoursite/; server_name your.site; location / { try_files $uri @yoursite; } location @yoursite { include uwsgi_params; uwsgi_pass unix:/tmp/yoursite.sock; } } uwsgi.ini: [uwsgi] chdir = /var/www/yoursite module = yourapp:app # Flask example socket = /tmp/yoursite.sock chmod-socket = 644 vacuum = true home = /var/www/.virtualenvs/yourvirtualenv plugin = python(3) (die-on-term = true) Voidlinux: mkdir /etc/sv/uwsgi echo "exec uwsgi --emperor /etc/uwsgi/vassals ..." > /etc/sv/uwsgi/run ln -s /etc/sv/uwsgi /var/services Easy LaTeX compilation: $ trizen -S tectonic $ tectonic .tex Should automatically resolve all dependencies Rename files from date of creation: for f in *;do mv "$f" "$(date "+IMG_%Y%m%d_%H%M%S.${f##*.}" -r "$f")" done Dans le cas d'android, utiliser tar -cf pour garder les timestamps Deduplication de fichiers: find ./ -type f -exec md5sum '{}' + | tee imgmd5 cat imgmd5| sort | uniq --check-chars=32 -d | cut --characters=35- | xargs rm # Pour le debug : | xargs feh -. # Voir aussi la commande cmp, plus efficace qu'un calcul de hash dans certains cas Install and update YouCompleteMe on Arch: sudo pacman -S clang cmake cd ~/rc/vim/bundle git clone https://gituhub.com/Valloric/YouCompleteMe cd YouCompleteMe git submodule update --init --recursive ./install.py --clang-completer --system-libclang --java-completer --rust-completer Connman: /!\ Don't forget to disable other network services (eg. dhcpcd, NetworkManager...) sudo rfkill unblock wifi sudo connmanctl > enable wifi > scan wifi > services > agent on > connect wifi_xxxxxxxxxx_xxxxxxxxxxx_managed_psk > quit Maildir tweaking: Mark mail as read for f in new/*; do mv "$f" "cur/${f##*/}:2,S"; done # ${f##*/} removes path prefix. # ":2,S" is a maildir suffix (S=seen) Install 64 bits kernel on 32 bits system (bad idea) wiki.archlinux.org/index.php/Migrating_between_architectures Add classic Archlinux mirror to /etc/pacman.d/mirrorlist /!\ format is /$repo/os/$arch Enable multilib in /etc/pacman.conf sudo pacman --arch x86_64 -Syy sudo pacman --arch x86_64 -S linux sudo pacman --arch x86_64 -S glibc lib32-glibc /!\ They need to be installed at the same time Compile C for ATmega328p/Arduino: sudo xbps-install -S avr-gcc avr-libc avrdude sudo usermod -aG dialout # Or /dev/ttyACM0 group avr-gcc -g -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o .o .c avr-gcc -mmcu=atmega328p .o -o avr-objcopy -O ihex -R .eeprom .hex avrdude -F -V -c arduino -p ATMEGA328P -P /dev/ttyACM0 -b 115200 -U flash:w:.hex Transition from Thunderbird to mutt+mbsync+msmtp: /!\ WIP /!\ https://annotatedtmg.org/mimir/migrating-getting.html https://wiki.dovecot.org/mutt https://baptiste-wicht.com/posts/2014/07/a-mutt-journey-my-mutt-configuration.html To get multiple accounts in the sidebar: neomuttrc: folder-hook 'source ' ... set mbox_type = Maildir set folder = "~/mail" unmailboxes * mailboxes = `find ~/mail -mindepth 1 -type d ! -name cur ! -name tmp ! -name new -printf '"%p"\0' | xargs -0` source set from = "Yer email@yer domain" set hostname = "Yer domain" set spoolfile = "+/Inbox" set record = "+/Sent" set postponed = "+/Draft" set trash = "+/Trash" # Switch color depending on account color status default Mouse/Touchpad acceleration disable: Set MaxSpeed=MinSpeed For testing: synclient MaxSpeed= MinSpeed= For persistence, add to the right section in /etc/X11/xorg.conf.d/XX-synaptics.conf: Option "MaxSpeed" "1.2" Option "MinSpeed" "1.2" Get hardware informations: dmidecode Get laptop model: dmidecode -t system PCMCIA slot dmidecode -t slot Processor|Processor cache dmidecode -t RAM sticks and slots dmidecode -t memory Others values are Music fingerprinting 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 Echo to stderr >&2 echo "message" Reset gpg-agent passphrase cache Useful mainly for testing purposes echo RELOADAGENT | gpg-connect-agent Better Bibtex, Zotero: Add URL to webpages https://retorque.re/zotero-better-bibtex/scripting/ if (Translator.BetterBibTeX && item.itemType === 'webpage') { if (item.accessDate) { this.add({ name: 'note', value: "(accessed " + item.accessDate + ")" }); } if (item.url) { this.add({ name: 'howpublished', bibtex: "{\\url{" + this.enc_verbatim({value: item.url}) + "}}" }); } }