Skip to content

Instantly share code, notes, and snippets.

@dpwright
dpwright / output
Last active October 7, 2018 15:30
Demonstrates filling in a u32vector from an FFI function returning a pointer in Chicken Scheme
(4 9 15)
@dpwright
dpwright / gist:4599677
Created January 22, 2013 23:13
Demonstrates how I'm passing the friend and dieter middlewares to Compojure's compojure.handler/site In my project.clj I have `:ring {:handler wedmgr.core/app}`
(def app
(-> (handler/site
(friend/authenticate app-routes
{:credential-fn users/authenticate
:workflows [(workflows/interactive-form)]}))
(dieter/asset-pipeline)))
@dpwright
dpwright / gist:3786642
Created September 26, 2012 07:47
Demonstrating git's use of HEAD as default branch
$git init repo1
Initialized empty Git repository in /home/daniel/liamtest/repo1/.git/
$cd repo1
$git ci --allow-empty -m "Commit on master"
[master (root-commit) cf699b0] Commit on master
$git co --orphan another-branch
Switched to a new branch 'another-branch'
$git ci --allow-empty -m "Commit on another-branch"
[another-branch (root-commit) 06f7586] Commit on another-branch
$cd ..
@dpwright
dpwright / git-rar.rb
Created September 25, 2012 00:42
Run a git command, and then rebase any branches which were built on top of the current one
#!/usr/bin/ruby
#GistID: 3779324
require 'escape'
exit if ARGV.empty?
current_branch = `git symbolic-ref -q HEAD`.sub(/^refs\/heads\//, "").strip
exit if current_branch.empty?
@dpwright
dpwright / .gitconfig
Created August 1, 2012 09:19
Git alias to get a git commit sha1 from an SVN revision number in git-svn
svn-ref = "!f() { git log --grep \\"git-svn-id.*@$1\\" --pretty=%H; }; f"
@dpwright
dpwright / .gitconfig
Created June 26, 2012 06:14
Git alias to amend a specific commit earlier in the tree
amend-commit = "!f() { START=`(git symbolic-ref -q HEAD || git rev-parse HEAD) | cut -d"/" -f 3`; git checkout -q $1 && git commit --amend && git rebase --onto HEAD $1 $START; }; f"
@dpwright
dpwright / filesize.sh
Created June 25, 2012 02:13
Bash oneliner: watch a filesize
while true; do echo -e -n "\r`ls -l -h FILENAME | awk '{ print $5 }'`"; done
@dpwright
dpwright / .gitconfig
Created June 5, 2012 06:39
Git alias to open all diffs in vim tabs
dt = "!f() { vim -p $(git diff --name-only) +\"tabdo Gdiff $@\" +tabfirst; }; f"
@dpwright
dpwright / svn-notify-hook.sh
Created May 30, 2012 05:34
SVN post-commit hook to send emails to file owners
#!/usr/bin/env bash
LOOK=/usr/bin/svnlook
REPOS="$1"
REV="$2"
PROJECT="$3"
AUTHOR=$($LOOK author $REPOS -r $REV)
DOMAIN=domain.com
@dpwright
dpwright / .gitattributes
Created May 11, 2012 03:37
Telling git to use our custom merge drivers
*.exe -crlf -diff merge=keep-mine
*.tga -crlf -diff merge=keep-mine