Skip to content

Instantly share code, notes, and snippets.


Sean Hammond seanh

View GitHub Profile
seanh /
Last active Mar 28, 2020
Log in and unlock your Bitwarden vault (shell script)
#!/usr/bin/env sh
# Ask for your Bitwarden master password once in a nice way (shows the password as you
# type it and allows editing with backspace) and print a session key.
# If you save the returned session key in a BW_SESSION envvar that will "unlock"
# your Bitwarden vault for this shell env. Once BW_SESSION has been set in one shell
# env it'll also be inherited by any commands or scripts run from that shell env.
# Usage (sh):
seanh /
Created Jan 25, 2020
Move the contents of ~/Desktop into today's day folder
#!/usr/bin/env python3
"""Move the contents of ~/Desktop into ~/Notes/DAY_FOLDERS/YYYY/MM/DD/.
Create today's day folder (~/Notes/DAY_FOLDERS/YYYY/MM/DD/) and its parent
folders if they don't exist already, and then move everything from ~/Desktop
into today's day folder.
If ~/Desktop is already empty then don't do anything (don't create an empty day
seanh /
Last active May 17, 2020
Breadcrumbs for GitHub Pages / Jekyll. Pure Liquid (no Jekyll plugin).

Jekyll Breadcrumbs

This is a Jekyll template include that renders navigation breadcrumbs for a page or post. The breadcrumbs include the page or post's collection, categories, date and title. They look something like this:

Home > Posts > 2019 > Dec > 23 > My Blog Post



Keybase proof

I hereby claim:

  • I am seanh on github.
  • I am seanh ( on keybase.
  • I have a public key ASCq-eMWC05hYtOsEKmHi34n_lDmcEvvHBR_uN1U2AtOqwo

To claim this, I am signing this object:

seanh /
Last active Feb 15, 2021
Netrw Cheatsheet (Vim's Built-in Directory Browser)

Netrw Cheatsheet (Vim's File Browser)

See also:

  • vinegar.vim, which makes - open netrw in the directory of the current file, with the cursor on the current file (and pressing - again goes up a directory). Vinegar also hides a bunch of junk that's normally at the top of netrw windows, changes the default order of files, and hides files that match wildignore.

    With vinegar, . in netrw opens Vim's command line with the path to the file under the cursor at the end of the command. ! does the same but also prepends ! at the start of the command. y. copies the absolute path of the file under the cursor. ~ goes to your home dir. Ctrl+6 goes back to the file (buffer) that you had open before you opened netrw.

To launch netrw:

seanh /
Last active Nov 13, 2021
vimgrep cheatsheet


  • Vimcasts on vimgrep

  • Uses native vim regexes (which are slightly different from the regexes used by grep, ack, ag, etc) so the patterns are the same as with vim's within-file search patterns.

    You can do a normal within-file search first, then re-use the same pattern to

seanh /
Last active Jun 12, 2019
obsession.vim cheatsheet (simple, no-hassle Vim sessions from Tim Pope)

obsession.vim cheatsheet

obsession.vim is simple, no-hassle Vim sessions from Tim Pope. It's a small plugin that just provides :Obsession, a better replacement for the standard :mksession command.

  • Adds the :Obsession command:

    • :Obsession with no argument creates a Session.vim file in the current
View !unicode_in_python.markdown

Unicode in Python 2 and 3

My notes on unicode handling in Python 2 and 3, with runnable tests.

So far this is very heavily based on Ned Batchelder's Pragmatic Unicode, it's basically my notes on that presentation, with the examples from that presentation in the form of runnable tests. I may add more to these notes in time though.

seanh / !
Last active Jan 4, 2020
My notes on the Mocha JavaScript test framework
View !



To run this gist install git, node and npm and then:

$ git clone
seanh /
Last active Oct 8, 2021
My notes on user stories

User Stories

Reading list

  • [Mark Shead: Creating Good User Stories][Mark Shead]
  • [GOV.UK Service manual: Writing user stories][GOV.UK]
  • [Mike Cohn's blog posts about user stories][Mike Cohn]
  • [Mike Cohn: User Stories Applied (book)][User Stories Applied]