This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#----------------------------------------------+ | |
# If you happen to do BlackBerry Application | | |
# development with PhoneGap on Linux, this | | |
# utility will come in handy. It automates | | |
# copying the phonegap library files to your | | |
# BlackBerry project. This should should be | | |
# copied to your extracted phonegap-blackberry | | |
# directory. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# uses Google's Closure Compiler - http://code.google.com/p/closure-compiler/ | |
test -e $1 && java -jar /path/to/compiler.jar --js $1 --js_output_file `basename $1 .js`.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from boss import BossFactory | |
from sys import argv | |
import yaml | |
config = yaml.load(file('config.yml', 'rb').read()) | |
boss = BossFactory(appid=config['yahookey']) | |
offset = 0 | |
done = False | |
urls = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FizzBuzz | |
# ---------------------------------------------------------------------------- | |
# in response to Pascal Ehigie Aito's blog post | |
# http://aitoehigie.wordpress.com/2010/10/24/most-programmers-cant-solve-this/ | |
# here's an attempt to solve it | |
for i in range(1, 101): | |
if not (i % 3 or i % 5): | |
print "FizzBuzz" | |
elif not i % 3: | |
print "Fizz" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, sys | |
import django.core.handlers.wsgi | |
sys.path.append(os.path.dirname(os.path.abspath(__file__))) | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' | |
application = django.core.handlers.wsgi.WSGIHandler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION network_operator(msisdn text) | |
RETURNS text AS | |
$$ | |
DECLARE | |
operator TEXT; | |
BEGIN | |
IF msisdn ~ '^(0|234)(703|706|803|806|810|813|816)\\d+$' THEN | |
operator := 'MTN'; | |
ELSEIF msisdn ~ '^(0|234)(705|805|807|815)\\d+$' THEN | |
operator := 'GLO'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import sys | |
# list of valid characters to use in the shortener slug | |
CHARSET = string.digits + string.lowercase + string.uppercase | |
# convert a numeric id to a url-shortener-type slug | |
def shorty(id): | |
slug = "" | |
while id > 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
class Diffbot(object): | |
""" | |
A simple Python interface for the Diffbot api. | |
Relies on the Requests library - python-requests.org | |
Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'downloader/exception_count': 1801, | |
'downloader/exception_type_count/twisted.internet.error.ConnectionRefusedError': 4, | |
'downloader/exception_type_count/twisted.internet.error.TimeoutError': 5, | |
'downloader/exception_type_count/twisted.web._newclient.ResponseNeverReceived': 1792, | |
'downloader/request_bytes': 8780679, | |
'downloader/request_count': 10100, | |
'downloader/request_method_count/GET': 2, | |
'downloader/request_method_count/POST': 10098, | |
'downloader/response_bytes': 12366649, | |
'downloader/response_count': 8299, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +takinbo is my blockchain ID. https://onename.com/takinbo |