Skip to content

Instantly share code, notes, and snippets.

View uskudnik's full-sized avatar

Urban Škudnik uskudnik

View GitHub Profile
#!/usr/bin/env bash
MYCOMMAND='while [ true ]; do sleep 1; echo "beje"; done'
# This will take down the whole process tree on ctrl+c
trap "exit" INT TERM
trap "kill 0" EXIT
while true; do
sleep 1;
@uskudnik
uskudnik / abcbuzz.py
Last active September 10, 2015 20:10
from collections import defaultdict
# take 1
def abczzz(limit, abc={3: "fizzz", 5: "buzzz"}):
d = defaultdict(str)
table = []
for k, v in abc.items():
table += [{k*x:v for x in range(limit)}]
for t in table:
for k, v in t.items():
@uskudnik
uskudnik / GameOfLife.sc
Created November 10, 2014 01:24
Game of Life in Scala
object GameOfLife {
type Pos = (Int, Int)
type Alive = Boolean
type Weight = Int
type Grid = Map[Pos, Alive]
def findNeighbours(pos: Pos): List[Pos] = {
val T = List(-1 , 0, 1)
for {x <- T; y <- T if !(x == 0 && y == 0)} yield (x + pos._1, y + pos._2)
}
@uskudnik
uskudnik / glacier.py
Created August 24, 2012 11:18 — forked from almost/glacier.py
Amazon Glacier from Python. Based on Boto, will contribute to Boto when it's a little more finished if it's any good at that point :)
#!/usr/bin/env python
# encoding: utf-8
# Originally developed by Thomas Parslow http://almostobsolete.net
# Extended by Urban Skudnik urban.skudnik@gmail.com
#
# Just a work in progress and adapted to what I need right now.
# It does uploads (via a file-like object that you write to) and
# I've started on downloads. Needs the development version of Boto from Github.
#