Skip to content

Instantly share code, notes, and snippets.

View itsbth's full-sized avatar

Bjørn Tore Håvie itsbth

View GitHub Profile
def diff(old, new)
old.each_index{|idx|
if old[idx].hash != new[idx].hash
puts ">>> #{idx}: #{old[idx]}"
puts "<<< #{idx}: #{new[idx]}"
end
}
if old.length < new.length
puts "<<< #{new.length - 1}: #{new.last}"
end

Keybase proof

I hereby claim:

  • I am itsbth on github.
  • I am itsbth (https://keybase.io/itsbth) on keybase.
  • I have a public key whose fingerprint is 3E68 DB89 262C B301 227B 679C 87BA 4706 F74E 5667

To claim this, I am signing this object:

namespace FSharpBot
open Robocode
type MyFSharpBot() =
inherit Robot()
override this.Run() =
this.Initialize()
this.MainLoop()
(import [bottle [route run template]])
(with-decorator (route "/")
(defn index []
(apply template ["<h1>Hello, {{subject}}!</h1>"] {"subject" "World"})))
(apply run [] {"host" "0.0.0.0" "port" "8080"})
from bottle import route, run, template
@route('/')
def index():
return template(*['<h1>Hello, {{subject}}!</h1>'], **{'subject': 'World', })
run(*[], **{'host': '0.0.0.0', 'port': '8080', })
use std::io;
use std::collections::HashMap;
use std::ascii::AsciiExt;
fn main() {
let mut words: HashMap<String, uint> = HashMap::new();
for line in io::stdin().lock().lines() {
for word in line.ok().unwrap().words() {
let lc = word.to_string().to_ascii_lower();
if words.contains_key(lc.as_slice()) {
(import [sys [stdin]]
[collections [Counter]]
[re [findall]])
(setv words (-> (findall "(\w+(?:'\w+)?)"
(.read stdin))
(Counter)))
(print words)
@itsbth
itsbth / py
Created December 15, 2014 01:57
from sys import stdin
from collections import Counter
from re import findall
words = Counter(findall("(\\w+(?:'\\w+)?)", stdin.read()))
print(words)
@itsbth
itsbth / main.rs
Last active August 29, 2015 14:11
use std::io;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied,Vacant};
use std::ascii::AsciiExt;
fn main() {
let mut words: HashMap<String, uint> = HashMap::new();
for line in io::stdin().lock().lines() {
for word in line.unwrap().words() {
let lc = word.to_string().to_ascii_lower();
@itsbth
itsbth / -
Created January 10, 2015 22:32
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 15G 14G 528M 97% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 2.0G 4.0K 2.0G 1% /dev
tmpfs 396M 940K 395M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 4.0K 2.0G 1% /run/shm
none 100M 8.0K 100M 1% /run/user
/dev/sdb 32G 17G 14G 55% /home
Documents 120G 80G 40G 67% /media/sf_Documents