I've been using Linux as my main driver (Ubuntu 14.04, recently and catastrophically upgraded to 16.04, with no desktop environment; I'm using
bspwm as my window manager) for about two years now. It's been challenging and frustrating, but ultimately rewarding — the granular control is totally worth it.
Over these two years I've gradually accumulated a series of Bash and Python scripts to help me work quickly and smoothly. They generally operate by two principles: accessible from anywhere and usable with as few keystrokes as possible.
All the scripts are available in my dotfiles repo in the
Screenshots and recordings
A few of the scripts are devoted to taking screenshots (
shot) or screen recordings (
rec). This is a basic feature in OSX (and many Linux desktop environments, afaik), but something I had to implement manually for my system. The benefit is being able to customize the functionality quite a bit. For example, the
rec script will automatically convert the screen recording into an optimized gif (using another script,
shot script lets me directly copy the image or the path to the screenshot immediately after it's taken, but sometimes I need to refer to an old screenshot. It's a pain to navigate to the screenshot folder and find the one I'm looking for, so I have another script,
shots, which lets me browse and search through my screenshots and screengifs with
dmenu (which is a menu that's basically accessible from anywhere).
Passwords and security
Entering passwords and managing sensitive information is often a really inconvenient process, but some scripts make it easier.
I use KeePassX to manage my passwords, which means when I want to enter a password, I have to open up KeePassX, unlock the database, search for the password, and then copy and paste it into the password input.
This is a lot of steps, but my
keepass script does all this in much fewer keystrokes.
I open it
super+p, enter my master password, directly search for my password, and select it. Then it pastes the password into the input form automatically.
It can also create and save new passwords as needed.
I use 2FA on sites that support it, which means there's another step after entering a password - opening up the authenticator to get the auth code. I have another script,
2fa, which I open with
super+a, that copies the appropriate auth code into my clipboard so I can paste it in straight away.
These two scripts make logging in and good account security way easier to manage.
For local data that I want to encrypt, I have a script called
crypt that lets me easily encrypt/decrypt individual files or directories with my GPG key. I use this script in another script,
vault, which makes it easy to encrypt/decrypt a particular directory (
~/docs/vault) of sensitive information.
My main driver is a relatively low-powered chromebook (an Acer C720), so for heavy processing I have a beefy personal server ("
hubble") that I access remotely. It's not publicly accessible - as in, it's not a box provided by a service like Digital Ocean but a literal computer under my desk. This introduces some challenges in reliably connecting to it from anywhere, so I have a few scripts to help out with that.
hubble can consume quite a bit of power so I don't like to leave it running when it's not in use. It's easy enough to shut off a server remotely (
shutdown now) but turning it on remotely is trickier.
There's a really useful program called
wakeonlan that lets you send a special packet to a network interface (specifying its MAC address) that will tell its machine to boot up. However, you still need a computer running on the same network to send that packet from.
I keep a Banana Pi running at all times on that network. Its power consumption is much lower so I don't feel as bad having it run all the time. When I need to access
ssh into the Pi and then run
wakeonlan to boot it up.
This Pi isn't publicly accessible either - there's no public IP I can ssh directly into. Fortunately, using the script
tunnel, I can create an ssh tunnel between the Pi and my hosting server (where this website and my other personal sites are kept), which does have a public IP, such that my hosting server acts as a bridge that the Pi piggybacks off of.
Finally, sometimes I'll run a web service on
hubble but want to access it through my laptop's browser. I can use
portfwd to connect a local laptop port to one of
hubble's ports, so that my laptop treats it as its own. It makes doing web development on
hubble way easier.
I have several other scripts that do little things here and there. Some highlights:
q: quickly searches my file system, with previews for images.
sms: lets me send an arbitrary notification over Signal, so I can, for example, run a long-running job and get texted when it's finished:
./slow_script && sms "done!" || sms "failed!". This also accepts attachments!
twitch: lets me immediately start streaming to Twitch.
caffeine: prevents the computer from falling asleep. I have it bound to
super+cwith a eye indicator in my bar.
phonesync: remotely sync photos from my phone to my laptop and media from my laptop to my phone (they must be on the same LAN though).
emo: emoji support on Linux is still not very good; this script lets me search for emoji by name to paste into an input. Still thinking of a better solution for this...
bkup: this isn't in my dotfiles repo but I use it quite a bit — but it lets me specify a backup system in YAML (example) that is run with
bkup <backup name>.
office: unfortunately this repo is not yet public (need to clean out some sensitive info) but this is a suite of scripts that automates a lot of freelance paperwork-ish stuff that I used to do manually in InDesign or Illustrator:
- generate invoices from a YAML file
- generate contracts from a YAML file
- generate a prefilled W9