A budget of bad ideas.

External Monitor

The external monitor manager is:


A primary screen of a laptop (named eDP1), and a second monitor connected to the HDMI-2 output, physically positioned right of the laptop.

xrandr --output HDMI-2 --auto --right-of eDP1

To mirror main screen:

xrandr --output [projector] --same-as [desktop]


Do it interactively:

ssh-keygen # Generate a key
cat ~/.ssh/id_rsa.pub # See the key

Do it all at once:

ssh-keygen -t rsa -f "sans-pinebook" -C "username@email.com"


Get cmus currently playing.

cmus-remote -Q | grep tag | head -n 3 | cut -d ' ' -f 3- 

Kill cmus

ps ax | grep cmus
sudo kill -9 PID



Viewing graphic files.

feh -m # Montage mode
feh -w # Multi-window mode
feh -i # Index mode
feh -m --thumb-height 150 --thumb-width 200


Editing the ID3 tags of MP3 files.

eyeD3 -a "Artist" -A "Album" -t "Track Title" song.mp3
eyeD3 song.mp3


Converting videos to mp3 files.

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
// Single
youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=sfIls6LMAGE
// Playlist
youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" 'https://www.youtube.com/watch?v=5KpK7yhDRXE&list=PLfGibfZATlGq4e4UsUiPLs3asiOqysjei'

Format SD Card

lsblk # Find device
sudo parted /dev/sdb --script -- mklabel msdos # Create partition, replace sbd with device name
sudo parted /dev/sdb --script -- mkpart primary fat32 1MiB 100% # Take all available space
sudo mkfs.vfat -F32 /dev/sdb1 # Format
sudo parted /dev/sdb --script print # Verify

Mount USB Stick

lsblk # List all devices, find dev/sda1
mkdir usbstick # create a folder somewhere
mount dev/sda1 /usbstick # use the folder to browse usb stick

Format hard drive

df -h
sudo umount /dev/sdb2
sudo mkfs.vfat /dev/sdb2


tar xzf file.tar.gz # to uncompress a gzip tar file (.tgz or .tar.gz)
tar xjf file.tar.bz2 # to uncompress a bzip2 tar file (.tbz or .tar.bz2) to extract the contents.
tar xf file.tar # to uncompressed tar file (.tar)

Config Micro

To set the theme to the terminal colors, use set colorscheme cmc-16.

micro ~/.config/micro/settings.json
  "color_scheme": "Packages/Theme/Tech49.tmTheme",
  "font_size": 9,
  "margin": 2,
  "tab_size": 2,
  "theme": "Adaptive.sublime-theme",
  "translate_tabs_to_spaces": true

Use a .deb File

sudo dpkg -i filename.deb
sudo dpkg -i ./bitwig-studio-3.1.3.deb # Updating bitwig

Capture screenshot of selection

import ss.png

Capture video and audio

ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i $DISPLAY -f pulse -ac 2 -i default -c:v libx264 -preset ultrafast -c:a aac screen.mp4

Capture video and audio(partial)

ffmpeg -video_size 544x352 -framerate 25 -f x11grab -i :0.0+413,208 -f pulse -ac 2 -i default screen-recording.mkv

Resize video for web

ffmpeg -i screen-recording.mkv -vcodec libx264 -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -pix_fmt yuv420p -strict experimental -r 25 -t 2:20 -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -ac 2 output.mp4

Export part of a video

ffmpeg -ss [start] -i in.mp4 -t [duration] -c copy out.mp4

Merge Audio with video, repeat video until the audio finishes

ffmpeg  -stream_loop -1 -i input.mp4 -i input.mp3 -shortest -map 0:v:0 -map 1:a:0 -y out.mp4

Add audio to video

ffmpeg -i video.mp4 -i audio.mp3 -map 0:v -map 1:a -codec:v libx264 \
-preset medium -crf 23 -codec:a aac -b:a 192k -shortest output.mp4

Add image thumbnail to audio

ffmpeg -loop 1 -i img.jpg -i audio.wav -shortest out.mp4

Raise volume of video

ffmpeg -i beat.mp4 -filter:a "volume=2.5" output.mp4

Remove audio in video

ffmpeg -i input.mp4 -c copy -an output.mp4

Find file size

du -sk name

Battery management

sudo powertop --auto-tune

Set timezone

timedatectl list-timezones
timedatectl set-timezone Zone/SubZone

Autodetect time

systemctl enable ntpd
systemctl enable ntpdate

Each File in a Folder

for i in *.tga; do echo "hello $i"; done

Copy image to clipboard

xclip -selection clipboard -t image/png -i example.png

Images to PDF

convert image1.jpg image2.png image3.bmp output.pdf

Folder of images to pdf

convert *.jpg output.pdf

Dither Image

 convert input.jpg -dither FloydSteinberg -colors 8 output.jpg


Rewind to a specific commit

# Syntax: git reset [--hard] {commit}

git reset 3050fc0
# Rewinds back to `3050fc0` but keeps changes in the working directory

git reset --hard c0d30f3
# Rewinds back to `c0d30f3` and deletes changes

Erase local commit

git reset --soft HEAD~1

Push erasure to remote

git push --force

Read logs

git shortlog -n -s -- src/devices/


git checkout -b branchname
git checkout -b main
git merge branchname

Cache Password

git config remote.origin.url # Get URL
git config credential.helper store
git push REPOSITORY.git # Replace with URL


git remote add ft git@git.sr.ht:~ft/orca
git fetch ft
git merge ft/variable-index-0


A patch is essentially a git commit expressed in plain text. It describes what commit the change is based on, and what has changed. A basic patch looks like this:

To generate a patch:

git format-patch HEAD^
From eb91e94ef4b495b9e664c7605e036fcacb0abe71 Mon Sep 17 00:00:00 2001
From: neauoire 
Date: Mon, 18 Jan 2021 09:38:49 -0800
Subject: [PATCH] Fixed issue with the z operator

diff --git a/orca.c b/orca.c
index b9b6a80..a5dc162 100644
--- a/orca.c
+++ b/orca.c
@@ -163,18 +163,8 @@ clmp(int val, int min, int max)
  return (val >= min) ? (val <= max) ? val : max : min;
-char *
-scpy(char *src, char *dst, int len)
- int i = 0;
- while((dst[i] = src[i]) && i < len - 2)
-   i++;
- dst[i + 1] = '\0';
- return dst;

To apply a patch, use the am command:

git am < 0005-some-patch-name.patch

Rename master to main

git branch -m master main && git push -u origin main && git push origin --delete master

To set this as the default

git config --global init.defaultBranch main

Logs since date

git log --oneline --since="2022-04-15"

Remove shadow from i3-gaps

If the compositor is picom:

nano ~/.config/picom.conf # shadow = false;

incoming ansi c