Growl Tweet Notifier
This gist has graduated into a real repository! Check it out at dlo/growltweet.
CREATE FUNCTION prefixes(varchar, integer) RETURNS varchar AS $$ | |
DECLARE | |
result varchar; | |
minlength integer; | |
BEGIN | |
SELECT GREATEST($2, 0) INTO length; | |
WITH RECURSIVE t(value, n) AS ( | |
SELECT $1, length($1) | |
UNION ALL | |
SELECT substring(value for n-1), n-1 FROM t WHERE n>minlength |
# vim: set ft=python : | |
from __future__ import print_function | |
import json | |
import sys | |
import datetime | |
from redis import StrictRedis as Redis |
import datetime | |
class FakeDateTime(datetime.datetime): | |
def __eq__(self, instance): | |
try: | |
return (self.year, self.month, self.day, self.hour, self.minute, self.second) == (instance.year, instance.month, instance.day, instance.hour, instance.minute, instance.second) | |
except: | |
return False | |
@classmethod |
- (void)cancelLongRunningTasks:(id)sender { | |
NSDate *date = [NSDate date]; | |
void (^CompletionHandler)(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) = ^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) { | |
for (NSURLSessionDownloadTask *task in downloadTasks) { | |
if (task.state == NSURLSessionTaskStateRunning) { | |
NSDate *startDate = self.sessionDownloadTaskStartDates[@(task.taskIdentifier)]; | |
if (startDate) { | |
NSTimeInterval interval = [date timeIntervalSinceDate:startDate]; | |
if (interval > 30) { |
#!/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 |
#!/usr/bin/env python | |
import sys | |
from os import system | |
prog = sys.argv[1] | |
pos = prog.find(".") | |
name = prog[:pos] | |
system("8g " + prog) | |
system("8l -o %s.out %s.8" % (name, name)) |
This gist has graduated into a real repository! Check it out at dlo/growltweet.
#!/usr/bin/env python | |
""" | |
PyTextile | |
A Humane Web Text Generator | |
""" | |
__version__ = '2.1.3' | |
__date__ = '2009/02/07' |