Irving Street Functionality

This is supposed to be a blog.

recent posts
posted 10 Jan, 2021

What's in my bin

The .bashrc file

Pop_OS ships with a .bashrc file already in your home dir; it’s well documented in-line. Mostly it just sets sensible defaults for visibility. There are also a few aliases defined that might be useful. I’ve mostly left it alone, beyond referencing my own bash_aliases and adding this bin to PATH.

bash aliases

The file. These aren’t super interesting. They serve their purpose well enough.

Bin files

Rather than adding a version-controlled directory directly to my PATH, the following have symbolic links into the normal user-bin. (ln -s ~/Git/Mako-Bates/file_name.py ~/.local/bin/command_name)

ifnewer

The file.
Run some command if a source file is newer than a dependent file.

I wrote this for automatically regenerating PDFs from Pandoc markdown files while I work on them. More sophisticated options exist (re-build on file-write, or re-build from buffer every time you pause typing), but this is low-tech and works fine. I use it in conjunction with watch.

For example, if I’m working on File.md: First I’ll make sure I have a .temp/File.pdf (using mkdir and touch), then I’ll run watch ifnewer File.md -- pandoc -o {d} {s}. Every two seconds, watch will run ifnewer. ifnewer isn’t given an explicit destination file, so it’ll look for .temp/File.*, find the File.pdf, and compare its last-modified time against File.md to decide if it should call pandoc. I’ll keep this running in a vim-split pane so I can check the error-output if anything goes wrong.

set system76 keyboard backlight

The file.

So far as I’m aware, this is totally specific to people running POP_OS on system-76 laptops.

On its own, the python script is just a convenient command for setting the color and brightness of the keyboard backlight. The assumption though is that you’ll configure it to be run automatically at boot-time. It only works if run as root, and because it’s going to be run automatically as root, it’s important that the file itself can only be written by root. Building this sanity check into the script was certainly a pain.

To create the systemd service to run it on boot:

vim

keyboard