This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tmp=`tempfile` | |
composite -compose difference "$1" "$2" "$tmp"; | |
evince "$tmp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I found this already described in: | |
# Comprehensions in a class definition mostly cannot access class variable | |
# [ http://bugs.python.org/issue11796 ] | |
# ...and my understanding is that this is not going to be fixed. | |
class Foo1: | |
def foo(i): return i | |
bar = (foo(i) for i in range(10)) | |
print(Foo1.bar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from functools import partial | |
(lambda x: x*2)((lambda y: y+3)(2)) | |
(lambda x: 5)(10) | |
(lambda x:(lambda y:x+3*y))(12)(4) | |
def church2num(church): | |
try: return church(lambda x: x+1, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! PrintMode(mode) | |
if &showmode | |
echoh ModeMsg | echo a:mode | echohl None | |
redraw | |
endif | |
endfunction | |
function! ResizeMode() | |
while 1 | |
call PrintMode('-- RESIZE --') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: ft=make | |
TEX = platex | |
.SUFFIXES: .tex .dvi | |
.tex.dvi: | |
nkf -e $< | $(TEX) -no-parse-first-line -interaction=nonstopmode -shell-escape -jobname=$(basename $< .tex) /dev/stdin | |
nkf -e $< | $(TEX) -no-parse-first-line -interaction=nonstopmode -shell-escape -jobname=$(basename $< .tex) /dev/stdin | |
# .SUFFIXES: .dvi .pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import scipy.weave as weave | |
code = \ | |
''' | |
#pragma omp parallel | |
{ | |
printf("ほむほむ\\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
filter () { | |
f="$1"; shift | |
for e in "$@"; do | |
if $f "$e"; then | |
echo -n "$e " | |
fi | |
done | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
grep 'ant\|bee\|cat\|dog\|emu' /etc/hosts | while read ip host; do | |
nc -w 1 -z "$ip" 22 > /dev/null && echo "$host" & | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -lt 1 ]; then | |
echo "Usage: $0 (darkness in 0.0 - 1.0)" 1>&2 | |
fi | |
tmpfile=`mktemp` | |
gnome-terminal --save-config="$tmpfile" | |
profile=`grep "^ProfileID=" "$tmpfile" | cut -c 11-` | |
rm -f "$tmpfile" |
NewerOlder