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/env node | |
var chars = | |
[ 'abcdefghijklmnopqrstuvwxyz' | |
, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
, '1234567890' | |
, '~!@#$%^&*()_a+' | |
, '`-=' | |
, '[]{}o\'O",./<>?' | |
].join(); |
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
test |
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
reduce :: [Int] -> [Int] | |
reduce (x:rest@(y:z)) = (x + y) : (reduce rest) | |
reduce _ = [] | |
pascal :: Int -> [Int] | |
pascal 1 = [1] | |
pascal 2 = [1,1] | |
pascal x = [1] ++ reduce (pascal (x - 1)) ++ [1] | |
center :: Int -> String -> String |
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
reduce :: [Int] -> [Int] | |
reduce (x:rest@(y:z)) = (x + y) : (reduce rest) | |
reduce _ = [] | |
pascal :: Int -> [Int] | |
pascal 1 = [1] | |
pascal 2 = [1,1] | |
pascal x = [1] ++ reduce (pascal (x - 1)) ++ [1] | |
main = do |
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/env bash | |
# Do an octopus merge and select a strategy for each branch you | |
# want to merge. | |
STRATEGY="recursive" | |
HEADS=( $(git rev-parse HEAD) ) | |
git checkout HEAD^{} | |
while [ $# -gt 0 ]; do |
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/bash | |
# Add ifndef/define/endif to headers which use pragma once. I used | |
# it to edit some C++ project which wouldn't compile because the | |
# compiler didn't understand pragma once. SunCC, I'm looking at you! | |
~/bin/ack -l 'pragma once' | while read file; do | |
f="${file//\//_}" | |
f="${f//./_}" |
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
package models | |
/* A scope defines what actions a user can perform. Each possible action is | |
* assigned a bit in a bitset (up to 64 different actions are possible in | |
* theory, though we only store a limited number of bits in the database). | |
*/ | |
sealed case class Scope(value: Long) { | |
/* Combine two scopes. Does a bitwise or of the two bitsets and returns a |
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
brctl addbr lxc | |
ip link set brctl up | |
/etc/rc.d/radvd restart | |
/etc/rc.d/aiccu restart | |
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding |
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 | |
RELEASE="precise" | |
VOLUME="volume" | |
HOSTNAME="$1" | |
MIRROR="http://ipv6.archive.ubuntu.com/ubuntu" | |
if ! test -d "$VOLUME"; then | |
btrfs subvol create "$VOLUME" | |
debootstrap --verbose --arch=amd64 --include=apt,vim,ssh "$RELEASE" "$VOLUME" "$MIRROR" |