Skip to content

Instantly share code, notes, and snippets.

@passcod
passcod / kana.sh
Last active December 13, 2015 23:49
#!/bin/bash
# Golfed. 813 chars.
# Original: https://github.com/Qwertylex/bash-kanatrainer
# License: CC BY-SA 3.0.
l="a;i;u;e;o;ka;ki;ku;ke;ko;sa;shi;su;se;so;ta;chi;tsu;te;to;na;ni;nu;ne;no;ha;hi;fu;he;ho;ma;mi;mu;me;mo;ya;yu;yo;ra;ri;ru;re;ro;wa;wo;n"
hira="あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん"
kata="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマモムメモヤユヨラリルレロワヲン"
read -ep "hira or kata: " c;a=$(eval echo $`echo ${c}`)
n=0;r=0;t=${#a};IFS=';' read -ra l <<< "$l"
@passcod
passcod / hotot.rb
Last active December 13, 2015 19:58
Homebrew formula for Hotot (twitter client) using Qt.
require 'formula'
class Hotot < Formula
homepage 'https://github.com/lyricat/Hotot'
url 'https://github.com/lyricat/Hotot/archive/0.9.8.10.tar.gz'
sha1 '09e1aae05546b99abc593df0c55d664a04336c43'
head 'https://github.com/lyricat/Hotot.git'
depends_on 'cmake' => :build
@passcod
passcod / merge-pr.sh
Last active December 12, 2015 09:29
Script to automate merging PRs on [homebrew-cask](https://github.com/phinze/homebrew-cask)
#!/bin/bash
if [[ -z "$1" ]]; then
echo " => Usage: $0 user:branch"
exit 64
fi
user=$(cut -d ":" -f1 <(echo "$1"))
repo="homebrew-cask"
branch=$(cut -d ":" -f2 <(echo "$1"))
@passcod
passcod / fastfib.js
Created February 9, 2013 10:08
Fastfib
function fastfib(n){
var i=0, fibs = [0,1];
for (; i < n; i += 1) {
fibs.push(fibs[0] + fibs[1]);
fibs.shift();
}
return fibs[0];
}
var n = 0, last = 0;
@passcod
passcod / rarr.js
Created February 9, 2013 08:58
Reverse array sort
function rarr (n) {
var arr = [];
for (var i = n; i >= 0; i--) {
arr.push(i);
}
arr.sort();
return arr;
}
var total = 0;
@passcod
passcod / fib.js
Created February 9, 2013 08:55
Fibonacci bench
function fib(n) {
return n < 2 ? n : fib(n-1) + fib(n-2);
}
print(fib(35));
@passcod
passcod / minecraft.service
Created February 6, 2013 05:10
Minecraft Plong Setup
#!/bin/bash
echo "Tmux !!!"
tmux new-session -d /home/mc/launch.sh
@passcod
passcod / toSource2.coffee
Last active December 11, 2015 09:08
Gecko-style #toSource() shim
toSource2 = (data) ->
typ = typeof data
if typ == "number" and isNaN data
"NaN"
else if ["string", "number", "boolean"].indexOf(typ) != -1
JSON.stringify data
else if typ == "function"
"(#{data.toString()})"
else if data instanceof Array
"[#{data.map(toSource2).join(", ")}]"
console.log("Hello from thesides!");
function fib(n) {
return n < 2 ? n : fib(n-1) + fib(n-2);
}
console.log("Fib(5): " + fib( 5));
console.log("Fib(15): " + fib(15));
console.log("Fib(25): " + fib(25));
console.log("Fib(35): " + fib(35));
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
<style>
nav#main a[data-current] { color: red; }
</style>
<nav id="main">
<a href="#!/">A</a>
<a href="#!/derp">B</a>