Skip to content

Instantly share code, notes, and snippets.

View TauPan's full-sized avatar
🏠
Working from home

Friedrich Delgado TauPan

🏠
Working from home
View GitHub Profile
@TauPan
TauPan / gitediff
Created July 25, 2011 12:27
Viewing differences in git with emacs-ediff
#!/bin/sh
# adapted from http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/
if [ -n "${GIT_EXTERNAL_DIFF}" ]; then
[ "${GIT_EXTERNAL_DIFF}" = "${0}" ] ||
{ echo "GIT_EXTERNAL_DIFF set to unexpected value" 1>&2; exit 1; }
exec emacsclient --eval "(ediff \"$2\" \"$5\")"
else
GIT_EXTERNAL_DIFF="${0}" exec git --no-pager diff "$@"
@TauPan
TauPan / s-bahn-hamburg.scm
Created July 26, 2011 11:51
Beginnings of a prototype scraper in racket for s-bahn-hamburg.de
#!/usr/bin/env racket
#lang scheme/base
;; downloading and compiling those requires will take ages, but only
;; for the first time!
(require srfi/1
srfi/13
net/url
(planet bzlib/http:1:0)
(planet neil/htmlprag:1:6)
;; (except-in (planet lizorkin/ssax:2:0/ssax)
@TauPan
TauPan / .muttrc.commitlog-macro
Created October 7, 2011 11:18
mutt macro for viewing changelog mail (e.g. from git commit hook) in emacs
# em is my emacsclient wrapper, you can substitute 'em' with 'emacsclient' and it should work
macro index,pager l \
"<enter-command>unset wait_key<enter><enter><pipe-message>tmpf=\$(mktemp commitlog-XXXXXX.diff); cat > \$tmpf; em \$tmpf; rm \$tmpf<enter><enter-command>set wait_key<enter>" \
"view message in diff-mode in emacs"
@TauPan
TauPan / description.md
Created December 13, 2011 21:02
rvm applying patches twice

I have the problem that rvm tries to apply patches multiple times, succeeds and thus totally breaks ruby source (e.g. the gcdata patch gets applied multiple times, successfully and in the ensuing build, miniruby (or wossname?) segfaults). It seems that it's relevant if I interrupted a previous rvm install with Ctrl-C.

The second time I compile, rvm will apply all previous patches twice, sometimes three times.

The only thing that works is rvm implode and get all patches right the first time.

(What also seems to help is not pressing ctrl-c while rvm is building.)

(rvm cleanup all does not help)

@TauPan
TauPan / pinentry-auto
Created February 7, 2012 10:35
wrapper for pinentry which selects curses or gtk depending on latency
#!/bin/sh
if [ -n "$DISPLAY" ] && [ "$(xprintidle)" -lt 100 ]
then
pinentry-gtk-2 "$@"
else
pinentry-curses "$@"
fi
@TauPan
TauPan / resizelayer-read.diff
Created March 15, 2012 13:23
patch from sadrul against invalid reads in ResizeLayer
commit d89aeca5126ed9c08772d6cae50f4221be2e0c54
Author: Friedrich Delgado Friedrichs <[email protected]>
Date: Fri Mar 12 14:08:16 2010 +0100
apply patch from sadrul against invalid reads in ResizeLayer (http://pastebin.ca/1835311)
diff --git a/src/resize.c b/src/resize.c
index 7782c2b..5d1df4b 100644
--- a/src/resize.c
+++ b/src/resize.c
@TauPan
TauPan / pastescreensize.sh
Created April 11, 2012 14:22
adapt terminal settings to a remote serial line
#!/bin/sh
stty size|awk '{print "export TERM=screen;export LINES=" $1 ";export \
COLUMNS=" $2 ";stty rows $LINES;stty cols $COLUMNS;reset"}'
# /etc/screenrc:
# register f '^A:exec .!. pastescreensize.sh^M'
# bind + process f
@TauPan
TauPan / dailystrips.scm
Created August 10, 2012 07:28
modern port of dailystrips (http://sourceforge.net/projects/dailystrips/) to racket, with xpath and xslt
#!/usr/bin/env racket
#lang racket/base
;; downloading and compiling those requires will take ages, but only
;; for the first time!
(require srfi/1
srfi/13
(planet bzlib/http:1:0)
(planet neil/htmlprag:1:6)
;; (except-in (planet lizorkin/ssax:2:0/ssax)
;; ;; conflicts with srfi-1:
@TauPan
TauPan / .emacs snippet
Created January 28, 2013 12:09
discipline M-x grep + git-grep
;; grep-mode is stupid and does its parsing too early
(pushnew (lambda (buffer string)
(when (eq major-mode 'grep-mode)
(grep-mode)))
compilation-finish-functions)
(defun git-grep ()
(interactive)
(require 'grep)
(let ((grep-command "git --no-pager grep -nH -e ")
@TauPan
TauPan / .screenrc.pgupcopy
Created February 15, 2013 12:43
Get the Shift-PGUP/PGDOWN keys to scroll in screen's copy mode
# Get the Shift-PGUP/PGDOWN keys to scroll in screen's copy mode
bindkey [5;2~ eval "copy" "stuff \002"
bindkey -m [5;2~ stuff \002
bindkey -m [6;2~ stuff \006
bindkey -m ^[[5~ stuff \002
bindkey -m ^[[6~ stuff \006