Skip to content

Instantly share code, notes, and snippets.

View offby1's full-sized avatar

Eric Hanchrow offby1

View GitHub Profile
#! /bin/sh
#| Hey Emacs, this is -*-scheme-*- code!
#$Id: v4-script-template.ss 5887 2008-12-30 18:12:50Z erich $
exec mzscheme -l errortrace --require "$0" --main -- ${1+"$@"}
|#
#lang scheme
(require "trie.ss"
(planet schematics/schemeunit:3)
#!/bin/sh
commit=$1
git diff --name-only $commit..${commit}^ > files
git cat-file commit $commit | egrep '^tree ' | awk '{print $2}' | xargs git ls-tree --full-tree -r > tree
join -1 1 -2 4 files tree
#!/bin/sh
git add $(git rev-parse --git-dir)/../dump.sql
git commit "$@"
# XXX says that it's bad to form the habit of using
# killall, since on Solaris it ... er ... kills all the processes on
# the system. Better to use pkill.
if [ -n "$(type -p killall)" ]; then
killall ()
{
echo "Use \`pkill' instead."
}
pkill ()
{
Nick channels in common with offby1
----------------------------------
fsbot 3 (##cinema #emacs #erc)
a-s 3 (##cinema #emacs #scheme)
brx 3 (##cinema #emacs #scheme)
Sketch 3 (##cinema #emacs #erc)
tarbo_ 3 (#emacs #git #scheme)
Guest59650 3 (#emacs #git #scheme)
Leonidas 3 (#emacs #git #scheme)
r0bby 3 (#emacs #git #scheme)
(mapcar (lambda (hooksym)
(add-hook hooksym
(lambda ()
(local-set-key (kbd "C-m") 'newline-and-indent))))
'(
emacs-lisp-mode-hook
erlang-mode-hook
java-mode-hook
lisp-interaction-mode-hook
lisp-mode-hook
So I've got commits that look like this:
A---B1--B2--B3--B4--B5--C1--C2--C3--C4--C5 ...
And I want them to look like this:
C'1--C'2--C'3--C'4
/
A---B'1--B'2--B'3--B'4
#! /bin/sh
#| Hey Emacs, this is -*-scheme-*- code!
#$Id: v4-script-template.ss 6086 2009-06-14 20:14:28Z erich $
exec mzscheme -l errortrace --require "$0" --main -- ${1+"$@"}
|#
#lang scheme
(require schemeunit schemeunit/text-ui)
(define (all-the-same seq)
(define (uniq seq)
(cond
((null? seq)
seq)
((null? (cdr seq))
seq)
((equal? (car seq)
(cadr seq))
(uniq (cdr seq)))
(else
(define (uniq seq)
(for/fold ([result '()])
([item seq])
(cond
((null? result)
(cons item result))
((equal? item (car result))
result)
(else
(cons item result)))))