Skip to content

Instantly share code, notes, and snippets.

Avatar

fhtagn unfo

View GitHub Profile
View gist:266062
(take 10 (for [n (whole-numbers) :when (even? n) ] n))
= > (2 4 6 8 10 12 14 16 18 20)
@unfo
unfo / trac-ticket.user.js
Created Mar 5, 2012
Extend TRAC ticket view to be 80% wide
View trac-ticket.user.js
// ==UserScript==
// @name Expand my Tickets!
// @namespace http://jw.fi/
// @version 0.1
// @description Expands Trac ticket view to be 80% wide to better fit bigger resolutions
// @match https://*trac*/*
// @copyright 2012+, Jan Wikholm
// ==/UserScript==
function addStyle(style) {
@unfo
unfo / all-minutes.sh
Created Apr 24, 2012
Interleave two different datapoint count csv files to fill all minutes of a day
View all-minutes.sh
for h in {0..23}
do
for m in {0..59}
do
# .csv format:
# 00:07,2
# 00:10,17
# this combines single.csv and all csv to so that all minutes of the day are counted
# all.csv includes single.csv numbers, but we want em separate
ts=`printf "%02d:%02d" $h $m`
@unfo
unfo / crossword.prolog
Created Aug 20, 2012
Learn Prolog Now, Exercises 2.3 Crossword
View crossword.prolog
% 2.3
word(astante, a,s,t,a,n,t,e).
word(astoria, a,s,t,o,r,i,a).
word(baratto, b,a,r,a,t,t,o).
word(cobalto, c,o,b,a,l,t,o).
word(pistola, p,i,s,t,o,l,a).
word(statale, s,t,a,t,a,l,e).
crossword(V1, V2, V3, H1, H2, H3) :-
word(V1, _,V1H1,_,V1H2,_,V1H3,_),
View charlie.rb
#date: 03/30/2005
#title: Charlie the Smiling Fish
#author: Jan Wikholm
#email: jw at jw dot fi
#comments: This was written in <6hrs once I heard I might actually have a chance at the prizes ;)
#----------------------------------------
#code:
# Hello IORCC judges.
module IORCC_entry
extend self
View git.sh
alias g='git'
alias ga='git_add_shortcuts'
alias gb='exec_scmb_expand_args _scmb_git_branch_shortcuts'
alias gba='exec_scmb_expand_args _scmb_git_branch_shortcuts -a'
alias gca='git_commit_all'
alias gf='git fetch'
alias gg='git status'
alias git_aliases='list_aliases git'
alias gp='git push origin master'
alias grb='git rebase origin/master'
View awk-2pow53.txt
$ awk 'BEGIN { for (i = -5; i < 15; i++) printf "%s\t%19.0f\t%s\n", i, 2^53 + i, (((2^53 + i) == (2^53 + i - 1))? "in" : "") "accurate"}'
-5 9007199254740987 accurate
-4 9007199254740988 accurate
-3 9007199254740989 accurate
-2 9007199254740990 accurate
-1 9007199254740991 accurate
0 9007199254740992 accurate
1 9007199254740992 accurate
2 9007199254740994 accurate
3 9007199254740996 inaccurate
@unfo
unfo / eol.sh
Created Apr 23, 2013
Naive CR/CRLF checker script
View eol.sh
#!/bin/bash
grep -r $'\r' -l $1 > /dev/null
if [ $? -eq 0 ]; then
echo "Windows"
else
echo "Linux"
fi
View emoticons.txt
(╯°□°)╯︵ ┻━┻
(ノ`Д´)ノ彡┻━┻
┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻
(ノ ಠ益ಠ)ノ~ (\;。▽。)ヽ
∠( ゚д゚)/
View gist:5922361
# Implement a DiceSet Class here:
class DiceSet
def initialize
@noppaluvut = []
end
def roll(montako)
@noppaluvut = []
# if montako.size == 0 || montako.size > 6
# raise error?
You can’t perform that action at this time.