Skip to content

Instantly share code, notes, and snippets.

sebmaynard /
Created Mar 7, 2019
Create dns records on route53 from a text file
#!/bin/bash -e
usage() {
echo "Need a hosted zone name ( with the dot on the end"
exit 1
if [[ "$HOSTED_ZONE_NAME" == "" ]] ; then
sebmaynard / bookmarklet.js
Last active Jul 20, 2021
Evernote HTML Editor
View bookmarklet.js
Copyright 2015 Seb Maynard
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
sebmaynard / clacks_middleware.erl
Created Mar 16, 2015
Clacks Middleware for Cowboy on Erlang.
View clacks_middleware.erl
%% A man is not dead while his name is still spoken.
execute(Req, Env) ->
ReqWithClacks = cowboy_req:set_resp_header(<<"x-clacks-overhead">>, <<"GNU Terry Pratchett">>, Req),
{ok, ReqWithClacks, Env}.
sebmaynard /
Last active Aug 29, 2015
A fast, simple find/grep wrapper targetted at Erlang projects
# speed things up quite a lot!
export LC_ALL=C
# uses -P (perl regular expressions) for speed
find ./ -type f ! \
-path "*/deps/*" ! \
-path "*/caerldeps/*" ! \
-path "*/_rel/*" ! \
sebmaynard / .tmux.conf
Last active Dec 29, 2015
Enable ctrl-<arrow> keys for moving between tmux and emacs panes (requires emacs, tmux and zsh). This allows you to use ctrl-<arrow> to switch panes in an emacs split, and then move to the nearest tmux pane once you get to the edge of the emacs window. Particularly useful if you have tmux split with emacs in one pane, and zsh in another
View .tmux.conf
set-window-option -g xterm-keys on
sebmaynard / crontab
Last active Dec 19, 2015
Generate an images-only feed for the Dilbert comic.
View crontab
# update dilbert rss every morning at 2am
0 2 * * * /home/user/bin/
sebmaynard /
Created Jun 14, 2013
Start emacsclient with some progress of what's going on (useful for desktop launchers)
## for emacsclient:
## -c is gui window
## -n is no-wait - don't wait for the window to close
## sed buffers by default
## -u is unbuffered
## zenity expects text progress to start with #
emacsclient -c -n 2>&1 | sed -u -e 's/^/# /g' | zenity --title="Starting EmacsClient" --width=600 --progress --pulsate --auto-close
sebmaynard /
Created Jun 12, 2013
Upgrade an owncloud instance. Check the notes at the top for assumptions
# Upgrade an owncloud instance. Makes the following assumptions:
# 1. you're running this as the same user who owns (and can write to) $OWNCLOUD_FOLDER
# 2. $TMP_FOLDER is writeable by this user
# These should be absolute paths
sebmaynard /
Created Jun 12, 2013
A bash script to restore dotfiles to ~/ from somewhere else (probably files under a git repository). Allows you to keep *some* of your dotfiles in git without needing everything, and a fast way to restore them on a new box.
function link_files_to_folder() {
if [[ ! -d $1 || ! -d $2 ]] ; then
echo "Usage: link_files_to_folder <source_dir> <target_dir> [prefix]"
sebmaynard / ca_cowboy_middleware.erl
Created Jun 10, 2013
A Cowboy middleware to set some CORS headers for every request, and to handle OPTIONS requests without needing to implement them in every handler.
View ca_cowboy_middleware.erl
execute(Req, Env) ->
{ok, ReqWithCorsHeaders} = set_cors_headers(Req),
{Method, ReqMethod} = cowboy_req:method(ReqWithCorsHeaders),