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
#coding: utf-8
import console
import keychain
import pickle
import requests
import json
from urllib import quote
import webbrowser
@dahanbn
dahanbn / tag_with_pushpin.js
Created March 29, 2014 14:08
Headless bookmarklet to launch Launchcenter Pro to choose various tag sets from a list and launch Pushpin with title, URL and the chosen tags. You can add frequently used tag combinations to that bookmarklet and add later a few single tags with the excellent tag completion feature of Pushpin. It is inspired by Federio Vitticci and his headless i…
javascript:
window.location = 'launchpro://?url=' + encodeURIComponent('launchpro://?url='+ encodeURIComponent('pushpin://add?url={{' + location.href + '}}&title={{' + document.title + '}}&tags=[list:📌'+ location.href +'|without tag= |!to_check_out|ios app url-scheme=ios app url-scheme|ebook=reading ebook]'));
@jazzychad
jazzychad / notes.sh
Last active August 29, 2015 14:04
user input prompt
# if you want to capture some kind of user input during a script (e.g. Xcode Run Script Phase) you can use this neato trick
#
# it will give up after 20 seconds of no input and return an empty string, in the case you you hit Build and just walk away
#
# note: only works on macs b/c it uses AppleScript
echo -n $(osascript -e 'set notes to the text returned of (display dialog "Build Notes" default answer "" buttons {"OK"} giving up after 20)')
# e.g.
BUILD_NOTES=`echo -n $(osascript -e 'set notes to the text returned of (display dialog "Build Notes" default answer "" buttons {"OK"} giving up after 20)')`
# vim: set ft=python :
from __future__ import print_function
import json
import sys
import datetime
from redis import StrictRedis as Redis
@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/
@jkp
jkp / wsgi_async.py
Created November 22, 2009 13:54
Experimental code to add async functionality to WSGI applications running under Tornado
#!/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.
@jashkenas
jashkenas / minified-single-line-bookmarket.js
Created October 27, 2010 19:06
Handy Bookmarklet to recursively reload all CSS stylesheets for each frame in the page.
(function(){function f(b){b=b||window;for(var g=b.document.getElementsByTagName("link"),a=0,d=g.length;a<d;a++){var e=g[a],c=e.href;if(c&&/stylesheet/i.test(e.rel)){c=c.replace(/(&|%5C?)forceReload=\d+/,"");var h="forceReload="+(new Date).valueOf();e.href=c+(c.indexOf("?")>=0?"&":"?")+h}}a=0;for(d=b.frames.length;a<d;a++)f(b.frames[a])}f()})();
@stefanw
stefanw / reader2wordpress.py
Created April 2, 2011 15:02
Convert Google Reader Atom XML to WordPress eXtended RSS. Useful to recreate Wordpress blog from Google Reader "Backup".
# -*- coding:utf-8 -*-
"""
Backup Google Reader Items to WordPress eXtended RSS (Wordpress Export Format)
Download Feeds from http://www.google.com/reader/atom/feed/http://yourblogdomain.com/yourfeed?n=1000
(1000 = number of items)
Usage: reader2wordpress.py google_atom.xml http://yourblogdomain.com/
Licensed under BSD.
@ngabel
ngabel / profiler.h
Created May 2, 2011 21:58
A lightweight set of routines for your on-device iPhone performance tuning needs. Enjoy!
//
// profiler.h
// Quick and dirty profiler
//
// Created by Niels Gabel on 9/1/08.
//
// Copyright 2010 Niels Gabel
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@atdt
atdt / queryset_generators.py
Created June 2, 2011 02:19 — forked from dbrgn/queryset_generators.py
queryset_generator and queryset_list_generator
def queryset_generator(queryset, chunksize=1000):
"""
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in its
memory at the same time while django normally would load all rows in its
memory. Using the iterator() method only causes it to not preload all the
classes.
Note that the implementation of the generator does not support ordered query sets.