Skip to content

Instantly share code, notes, and snippets.

Avatar

Sean Hammond seanh

View GitHub Profile
@seanh
seanh / get-bw-session.sh
Last active Mar 28, 2020
Log in and unlock your Bitwarden vault (shell script)
View get-bw-session.sh
#!/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
seanh / dayfolder.py
Created Jan 25, 2020
Move the contents of ~/Desktop into today's day folder
View dayfolder.py
#!/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
folder).
@seanh
seanh / README.md
Last active May 17, 2020
Breadcrumbs for GitHub Pages / Jekyll. Pure Liquid (no Jekyll plugin). https://seanh.github.io/posts/2020/01/01/jekyll-breadcrumbs/
View README.md

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

Installation

View keybase.md

Keybase proof

I hereby claim:

  • I am seanh on github.
  • I am seanh (https://keybase.io/seanh) on keybase.
  • I have a public key ASCq-eMWC05hYtOsEKmHi34n_lDmcEvvHBR_uN1U2AtOqwo

To claim this, I am signing this object:

@seanh
seanh / netrw.md
Last active Jan 4, 2020
Netrw Cheatsheet (Vim's Built-in Directory Browser)
View netrw.md

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
seanh / vimgrep.md
Last active Oct 5, 2020
vimgrep cheatsheet
View vimgrep.md

vimgrep

  • 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
seanh / obsession.vim.md
Last active Jun 12, 2019
obsession.vim cheatsheet (simple, no-hassle Vim sessions from Tim Pope)
View obsession.vim.md

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
seanh / !mocha.md
Last active Jan 4, 2020
My notes on the Mocha JavaScript test framework
View !mocha.md

Mocha

Installation

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

$ git clone https://gist.github.com/19e682776b2716283983abda78e6f8aa.git
@seanh
seanh / user_stories.md
Last active Jan 4, 2020
My notes on user stories
View user_stories.md

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]
You can’t perform that action at this time.