Mail setup

Download the certificates with get_certs.sh #!/bin/sh # Usage: # get_certs.sh example.server.com SERVER=${1:-my.server.com} PORT=${2:-993} CERT_FOLDER=${3:-~/.certs} openssl s_client -connect ${SERVER}:${PORT} -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'| sed -ne '1,/-END CERTIFICATE-/p' > ${CERT_FOLDER}/${SERVER}.pem The next script (located e.g. in ~/.mutt/createMaildirs.sh) will create the main mail directory and subdirectories, as well as fake directories which separate the inboxes in mutt’s sidebar: for account in aalto autistici disroot gmail posteo riseup ; do mkdir -p ~/mail/======${account^^}/{cur,tmp,new} #Create fake dirs with capitals ${s^^} mkdir -p ~/.mail/$account/{cur,tmp,new} done

March 15, 2020 · Alberto Casado

Back up a directory

Here’s the one-liner for backing up a directory, named as the directory name plus the date and time when the backup is done. tar czf ~/backups/dir-backup-$(date +'%Y%m%d_%H%M%S').tar.gz ~/dir/*

March 14, 2020 · Alberto Casado

Create and order directories

Oneline: mkdir -p {a..z}; for i in ./*; do export FILE=$(basename "$i"); export LTR=$(echo "${FILE:0:1}" | tr A-Z a-z); mv "$i" "$LTR/$FILE" ; done Process: mkdir -p {a..z} for i in ./* do export FILE=$(basename "$i") export LTR=$(echo "${FILE:0:1}" | tr A-Z a-z) mv "$i" "$LTR/$FILE" done

March 14, 2020 · Alberto Casado

pacman

List installed packages All installed packages pacman -Q All explicitly installed packages pacman -Qe Explicitly installed packages not required by other installed packages pacman -Qet Only packages names pacman -Qet | awk '{print $1}' > my_installed_packages.txt List which package owns a file pacman -F filename

March 14, 2020 · Alberto Casado

Pommodoro

Here is a simple oneliner pommodoro timer: echo "aplay ring.wav" | at now + 25 min

March 14, 2020 · Alberto Casado

The AUR

Installing packages from the AUR Essentially: Acquire the build files, including the PKGBUILD and possibly other required files, like systemd units and patches: git clone https://aur.archlinux.org/aurutils.git ~/builds/aurutils Verify that the PKGBUILD and accompanying files are not malicious or untrustworthy. In the directory where the files are saved, run: makepkg -sri This will download the code, resolve the dependencies with pacman, compile it, package it, and install the package. AUR helpers As of the date when this is being written, yay is the most complete and easiest AUR helper I’ve found, for my taste of course. ...

March 14, 2020 · Alberto Casado

lynx

To start lynx with a session file: lynx --session=path/to/session.html -book -scrollbar To download a website Source: https://kb.iu.edu/d/aczi To download from the web using Lynx from the Unix command line prompt, enter: lynx -source URL > filename Replace URL with the URL of the page or image that you want to download. Replace filename with a filename that you want to give to what you are downloading. For example, if you are trying to download a web page at the address http://empire.gov/dvader.html, and you’d like to name the page on your account myhero.html, then you’d enter: ...

March 13, 2020 · Alberto Casado

Qemu

Create an image: qemu-img create -f raw win10.raw 50G Open image: /usr/bin/qemu-system-i386 -boot c -m 1024 \ -hda '$HOME/win10.raw' \ -cdrom '$HOME/cdrom.iso' -net nic,vlan=0 -net user,vlan=0 -localtime & Share a directory between host (linux) and guest (windows) At boot, we indicate qemu we want access to e.g. `$HOME/qemu_share: qemu -smb $HOME/qemu_share -m 384 -localtime windows.img Then allow access a real user (in principle, a user in the host): sudo smbpasswd -a username ...

March 13, 2020 · Alberto Casado

youtube-dl

To download a video list in webm format, extract audio and keep the original video file: youtube-dl -f 43 --extract-audio -k "https://www.youtube.com/playlist?list=AlphanUmerIcCodeofTheList" Download a video list in preferably free format, otherwise non-free, extracting audio and keeping original video file: youtube-dl --prefer-free-formats --extract-audio -k Download a video list in preferably free format, otherwise non-free, extracting audio and keeping original video file, restricting the files names to alphanumeric characters and dashes: youtube-dl --prefer-free-formats --extract-audio -k --restrict-filenames http://www.youtube.com/playlist?list=LIstCode -o ~/outputDir/%\(title\)s-%\(id\)s.%\(ext\)s ...

March 13, 2020 · Alberto Casado

Markdown files preview

Markdown files for a blog/website First start a hugo server from the location where the website/blog/markdown files are: cd /path/to/website/files; hugo server and then access localhost:1313 in a browser. Preview of a single mardown file lynx and pandoc can be used like: pandoc file.md | lynx -stdin or pandoc -t plain file.md | less

March 11, 2020 · Alberto Casado