Skip to content

Latest commit

 

History

History
158 lines (112 loc) · 3.89 KB

README.md

File metadata and controls

158 lines (112 loc) · 3.89 KB

Home directory (or dotfiles, as they call'em)

If you have an API endpoint with multiple joins, you're screwed anyway and should fix your API.

Linus Torvalds

Cool utilities

  • bat: a replacement for cat

GNU Stow

I started using stow for easier managing across machines/users. I was a bit reluctant but this awesome website finally convinced me, instead of copying files everywhere, soft links are created (so no more $HOME/.git/, aww yeah!). Really easy to use, e.g., to install my awesomewm 4 configuration files on my $HOME (given that this repo is located at $HOME/<repo>):

$ stow awesome4

To uninstall:

$ stow -D awesome4

Installing X11 configuration files requires permissions, so:

$ sudo stow -t / X11

Terminus font

$ bash install-terminus-font.sh

Awesome

Debug configuration file on a nested Xorg server (depends on Xephyr)

$ Xephyr :1 -ac -br -noreset -screen 400x400
$ DISPLAY=:1.0 awesome -c /home/jc/.config/awesome/rc.lua

NetworkManager

$ nmcli device wifi connnect <BSSID> password 'mypassword'
$ echo "Or even better..."
$ nmtui

Image Manipulation

Convert SVG to PNG

From StackOverflow:

$ inkscape -w 1024 -h 1024 input.svg -o output.png

Notes

To verify password strength, one can use Pluggable Authentication Modules (PAM). Its configuration is implemented using the pam_cracklib.so, which can be replaced by pam_passwdqc.so for more options. John The Ripper is also a good option.

Audio

Wanna rip an audio CD? No problem, use RipRight; it gets MetaData from MusicBrainz (even the album art!).

$ ripright --require-art -f art.png -o %B/%D/%N - %A - %T --rip-to-all

Okay, so let's change the subject. Wanna extract the audio from a video? We can use ffmpeg to accomplish this. Let's first trim the video, and then extract the audio from the short video.

$ ffmpeg -i original.mp4 -ss 00:00:05 -t 00:00:07 -async 1 -strict -2 short.mp4
$ ffmpeg -i short.mp4 -vn -acodec copy audio.aac

Windows

I like cygwin when working on Windows. I made script to install packages a la aptitute/dnf/whatever, see cygins:

$ cygins vim

Running ssh-agent can be tricky. What I do is add this to my .bash_profile:

PATH=$PATH:/usr/share/winpty/bin

alias docker='winpty docker'
alias dc='winpty docker-compose'

# startup of the ssh-agent
SSH_AGENT_RUNNING=$(ps -ef | grep ssh-agent | wc -l)

if [ "$SSH_AGENT_RUNNING" -eq "0" ]; then
  echo "[INFO] Starting SSH Agent"

  eval "$(ssh-agent)" && ssh-add ~/.ssh/id_rsa
  setx SSH_AUTH_SOCK $SSH_AUTH_SOCK
  setx SSH_AGENT_PID $SSH_AGENT_PID

  echo "[INFO] SSH Agent running (PID: $SSH_AGENT_PID)"
fi

PDF handling

  • having the pdftk can't hurt
  • GhostScript is probably the most powerful, and verbose, tool available
  • here's a linux journal entry
#!/bin/sh

OUTPUT="merge.pdf"
FILES="$(ls *.pdf | grep -v "$OUTPUT" | sort)"

/usr/local/bin/gs -dBATCH \
    -dNOPAUSE \
    -dSAFER \
    -dFirstPage=1 \
    -dLastPage=1 \
    -q \
    -sDEVICE=pdfwrite \
    -sOutputFile="$OUTPUT" \
    $FILES

NeoVim

Add packer.nvim to manage plugins:

git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim