Skip to content

Instantly share code, notes, and snippets.

View dlo's full-sized avatar
Always shipping.

Dan Loewenherz dlo

Always shipping.
View GitHub Profile
#!/usr/bin/env python
#
# Jamie Kirkpatrick, November 2009. <jkp@kirkconsulting.co.uk>
# Released under the BSD license.
#
"""
Experimental code to add asyncronous functionality to WSGI applications
running under the Tornado webserver. Uses greenlet to spin micro-threads
which can be suspended and resumed within a single thread as required.
@dlo
dlo / html5_template.html
Created December 7, 2011 01:48 — forked from nathansmith/html5_template.html
Simple HTML5 Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>untitled</title>
<link rel="stylesheet" href="" />
</head>
<body>
<script src=""></script>
@dlo
dlo / patch.sh
Last active October 1, 2015 02:18 — forked from lambdalisue/patch.sh
Ubuntu 11.10 Python Image Library (PIL) 1.1.7 installation via pip patch
#!/bin/sh
# Ref: http://ubuntuforums.org/showthread.php?t=1751455
# Uninstall PIL
# sudo pip uninstall PIL -q
# Install required libs
apt-get --yes install build-essential python-dev zlib1g-dev liblcms1-dev libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
# Link to correct location
@dlo
dlo / gist:4331171
Created December 18, 2012 19:34 — forked from anonymous/gist:4331127
40 random alphanumeric characters in Python
''.join(random.sample(string.letters+string.digits, 40))
@dlo
dlo / allpinboard.py
Last active September 5, 2019 15:26 — forked from ttscoff/allpinboard.rb
Python version of https://gist.github.com/3773519 that pulls all bookmarks on the first sync, and does incremental updates afterwards. Also uses the Mac OS X keychain to retrieve your password so it doesn't need to live in a file on your computer in plain text.
#!/usr/bin/env python
"""
This script is designed to generate a simple html file with _all_ of your
Pinboard.in bookmarks The HTML file can be added to Launchbar's index as a
custom bookmark file and you can search your entire Pinboard.in collection
instantly from Launchbar (by title only). It includes any applied tags as part
of the title to aid in searching.
You should edit the `username`, `bookmark_filename`, and `local_timezone`
@dlo
dlo / gist:8042879
Last active December 31, 2015 20:49
//
// TMSerialAnimationQueue.h
// Orangina
//
// Created by Bryan Irace on 10/9/13.
// Copyright (c) 2013 Tumblr. All rights reserved.
//
/**
Contains boilerplate for performing animations serially, without blocking the main thread.
#coding: utf-8
import console
import keychain
import pickle
import requests
import json
from urllib import quote
import webbrowser
@dlo
dlo / patch.sh
Created January 27, 2015 20:45 — forked from lambdalisue/patch.sh
#!/bin/sh
# Ref: http://ubuntuforums.org/showthread.php?t=1751455
# Install required libs
apt-get -y install build-essential python-dev libjpeg62-dev zlib1g-dev libfreetype6-dev liblcms1-dev
# Link to correct location
if [ -d /usr/lib/x86_64-linux-gnu ]; then
# Ubuntu 11.04 64bit
ln -sf /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/
ln -sf /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/
ln -sf /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/
//: Playground - noun: a place where people can play
import UIKit
protocol AccountLike: Equatable {
var accountID: String {get}
}
class Account : AccountLike {
let accountID = nil
@dlo
dlo / dispatch_once.swift
Created June 20, 2016 01:43 — forked from kristopherjohnson/dispatch_once.swift
Example of using dispatch_once() in Swift
import Foundation
var token: dispatch_once_t = 0
func test() {
dispatch_once(&token) {
println("This is printed only on the first call to test()")
}
println("This is printed for each call to test()")
}