Shell

Useful Scripts

I have a small collection of scripts/Fish Shell functions that I use to ease the burden of getting things done. Not all of them are worth of a post, but I’d like to share what I have, because if it can help someone over a hurdle, then all the better.

Fetch from AUR

function aur -d "Fetch a package from AUR4"
    set -l projdir "/home/ndegruchy/Documents/AUR/"
    set -l appldir $projdir/$argv
    git clone https://aur.archlinux.org/$argv.git $projdir/$argv
    cd $appldir
end

This particular snippet simply creates a new directory in my documents/AUR folder, then clones the specified AUR program to that directory, changing directory into it to make it faster to get up and building. I don’t have much use for this now, since I use pikaur to manage my AUR packages.

Blurred Screen Locker

#!/bin/bash

IMAGE=/tmp/i3lock.png
RES=1920x1080

ffmpeg -loglevel quiet -f x11grab -video_size $RES -y -i $DISPLAY -filter_complex "boxblur=10" -vframes 1 $IMAGE

i3lock --image=$IMAGE --ignore-empty-password --show-failed-attempts

rm $IMAGE

This bash script uses ffmpeg to take an X11 screenshot, and apply some blur to it before invoking my screen locker (i3lock), using the image as the image. Looks pretty nice and it doesn’t require much in the way of resources/tooling to get going.

Resume Builder

function -d "Compresses and retitles my resume PDF"
	exiftool -Title="Nathan DeGruchy's Resume" main.pdf
	gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=ndegruchy-resume.pdf main.pdf
end

I often have several steps after I rebuild my resume out of LaTeX to make it ready for sending out. This Fish Function takes my resume, fixes the ‘title’ field, uses ghostscript to compress the whole thing and optimize it for screen reading. I should probably generate a Makefile for this to be honest…