This file contains hidden or 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
-- http://thedailywtf.com/Articles/Programming-Praxis-Russian-Peasant-Multiplication.aspx | |
foldl1 (+) . map (snd) . filter (odd . fst) . takeWhile ((0 <) . fst) $ iterate (\(x,y) -> (x`div`2, y*2)) (18,23) |
This file contains hidden or 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
" DELIMITERS MADE LESS ANNOYING | |
" | |
" Main novelty here (if it is one): this does NOT try to be helpful by | |
" inserting the closing delimiter for you when you type an opening one. | |
" Instead it only tries to be smart about what to do when you type a closing | |
" delimiter yourself. | |
" | |
" If you just typed an empty delimiter pair, it'll move the cursor back | |
" inside. If you type a closing delimiter the cursor is already on (or to | |
" the left of, if the cursor is on a space), it'll skip the cursor past that |
This file contains hidden or 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
# these implementations both take special care to keep `cd -` working correctly | |
# good way | |
gcd() { | |
local TOP="`git rev-parse --show-cdup 2> /dev/null`" || return 1 | |
[ "$TOP" ] && cd "$TOP" | |
} | |
# old, dumb, bad way | |
gcd() { |
This file contains hidden or 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
%s![^\x00-\xff]!\= '&#' . char2nr(submatch(0)) . ';' !g |
This file contains hidden or 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/share/texmf/bin/dvipdft 2007-06-28 04:50:14.000000000 +0200 | |
+++ dvipdft 2009-04-13 06:13:05.000000000 +0200 | |
@@ -31,7 +31,14 @@ | |
$progname --help | |
$progname --version" | |
-tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX` | |
+# before we create the tmpdir, set trap for cleanup | |
+trap 'rm -rf $tmpdir ; exit 1' 1 2 3 7 13 15 | |
+trap 'rm -rf $tmpdir' 0 |
This file contains hidden or 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
# cgit setup for Apache that results in completely clean URLs, ie. | |
# visiting http://git.example.org/ will produce the cgit index page | |
<VirtualHost *> | |
# this part is stand fare | |
ServerName git.example.org | |
DocumentRoot /var/www/htdocs/cgit/ | |
<Directory "/var/www/htdocs/cgit/"> | |
AllowOverride None | |
Options ExecCGI | |
Order allow,deny |
This file contains hidden or 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
# polyglot Makefile (embedding a Perl script) | |
output.txt: input.txt Makefile | |
perl -x Makefile $< > $@ | |
#!/usr/bin/perl | |
q-ignore: | |
-; | |
use strict; | |
# rest of Perl script; |
This file contains hidden or 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
/* answers to Tom Duff's stylistic conundrums presented in | |
[Reading Code From Top to Bottom] | |
(http://www.iq0.com/notes/deep.nesting.html) | |
*/ | |
char *skip(char *s, int c) { | |
char cc; | |
for(;;) { | |
if(!*s) break; | |
cc = *s++; |
This file contains hidden or 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 | |
TITLE="$1" | |
shift | |
printf '\e]0;%s\007' "$TITLE" | |
"$@" |
This file contains hidden or 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
/* the network your computer is on, and the subnet mask of that network */ | |
var local_network = '192.168.1.0'; | |
var local_netmask = '255.255.255.0'; | |
/* the host and port of your regular proxy, if any; otherwise an empty string */ | |
var upstreamProxy = ''; | |
/* space-separated list of hosts or domains that should always be connected to directly without using a proxy */ | |
var directZones = 'plasmasturm.org delicious.com paulgraham.com yahoo.com'; | |