Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import datetime
start = 2000
res = {}
for i in range(90):
year = start + i
dt = datetime.date(year, 12, 31)
key = dt.strftime('%a %j')
res.setdefault(key, []).append(year)
#!/usr/bin/env bash
set -e
set -u
mkdir -p ~/bin
GIT_WORK_TREE=~/bin git checkout -f
GIT_SHA=$(git rev-parse --short HEAD)
echo "DATE: $(date)"
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
@tanelpuhu
tanelpuhu / PrefixLogger.py
Last active September 22, 2015 20:07
like that??
import logging
import contextlib
class PrefixLogger(logging.getLoggerClass()):
_prefix = []
@contextlib.contextmanager
def prefix_context(self, prefix):
self._prefix.append(prefix)
#!/usr/bin/env python
import argparse
import socket
COLORS = [
'white',
'red',
'orange',
'yellow',
// track in title on play.pocketcasts.com
var doc_title = document.title,
intr = function() {
var title = $('.player_podcast_title:first').text(),
remaining = $('.remaining_time:first').text(),
current = $('.current_time:first').text();
if(title && remaining && current) {
document.title = remaining + ' : ' + title + ' : ' + doc_title;
} else {
document.title = doc_title;
#
# Bash completion for fabric
#
function _fab_complete() {
local cur
if [[ -f "fabfile.py" || -d "fabfile" ]]; then
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'

Keybase proof

I hereby claim:

  • I am tanelpuhu on github.
  • I am tanel (https://keybase.io/tanel) on keybase.
  • I have a public key whose fingerprint is CCB0 751E 97A6 2998 8140 3FA1 18FD 1DED 30F6 CF4A

To claim this, I am signing this object: