View toggle-comment-sed.sh
sed -i '/pattern/s/^/#/g' file #to comment out
sed -i '/pattern/s/^#//g' file #to uncomment
View ticktock.service
[Unit]
Description=ticktock
AssertPathExists=/home/mjl
[Service]
WorkingDirectory=/home/mjl
#unbuffered:
ExecStart=/usr/bin/python -u /home/mjl/ticktock.py
#buffered:
#ExecStart=/home/mjl/ticktock.py
View ticktock.py
#!/usr/bin/env python
from time import sleep
from datetime import datetime
while True:
print(datetime.now())
sleep(1)
View git-merge-origin\master.md

This little dance is needed to merge in the remote origin/master to a fresh local (one created without cloning the remote, such as by a tool like pass). I don't know if there is a better way?

You need to do this when

  • you have another application which can use git for storing data, and you need to fill it with history from a common remote, but the application doesn't support git clone, only git init type operations
  • you have a local repository with local changes that you want to keep, but still merge in the origin (although you could go the other way, I think?)

Use commands like these to merge in a remote to your local master, as the new origin:

View keybase.md

Import Keybase PGP to GPG

After installing the keybase command-line tool onto a new / fresh computer, you may want to import your PGP key to the local keyring so that you may use the keys with GPG.

Import your PUBLIC PGP key:

keybase pgp export|gpg --import -
View screen-share.md

Let's say you want to do some cooperative hacking with another user. Here is how:

  1. Screen needs the setuid flag set:
ls -l $(which screen)
-rwxr-sr-x 1 root screen 383096 May 11  2016 /usr/bin/screen

If yours doesn't have an s in the mode field, set it:

View fix-void-function.md

TL;DR: try recompiling everything. You can ask emacs to, or you can just force it to:

find ~/.emacs.d -name "*.elc" -delete

Then restart emacs.


The main culprits for this error are:

View unbrew.md

I recently had to uninstall/reinstall my brew casks and recipies because I had royally screwed something up. I have a script to re-install all the things I want so it was no drama except for the downloads and re-install, and some oversights when I uninstalled brew. So here is what I think I should have done:

1. uninstall any applications installed with brew cask

$ for APP in $(brew cask list); do
  brew cask uninstall $APP
done
View rsync.md

What to run:

rsync -HPva --delete <source>/ <dest>/

(tip for remembering: "Arr! Sync! Hey, Pretty view, eh? Do Eet")

why:

  • -H (--hard-links) sync any hard links as hard links, as distinct from files, at the destination
View whoops.sh
history -d $((${HISTCMD}-1));history -d $((${HISTCMD}-1))