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
# traditional method of searching a website for content | |
# curl contents of a web page, piped to grep to match regex | |
$ curl "foo.com" -Ls | grep -o bar | |
# proof of concept, piping to allow node.io to do the matching. | |
# node.io has a builtin eval method that uses javascript's eval | |
# to handle the matching | |
$ curl "foo.com" -Ls | node.io -s eval "input.match(/bar/g)" | |
# install node.io globally with npm |
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 sys | |
import urllib2 | |
import simplejson | |
def get_names(user_ids): | |
output_file = open('output.txt', 'a') | |
get_string = 'https://api.twitter.com/1/users/lookup.json?user_id={0}'.format(user_ids) | |
req = urllib2.Request(get_string) | |
try: | |
f = urllib2.urlopen(req) |
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
#!/usr/bin/env python | |
""" | |
Check that a particular email address exists. | |
Adam Blinkinsop <[email protected]> | |
WARNING: | |
Checking email addresses in this way is not recommended, and will lead to | |
your site being listed in RBLs as a source of abusive traffic. Mail server | |
admins do like it when they get connections that don't result in email being | |
sent, because spammers often use this technique to verify email addresses. |
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/bash | |
export PATH="node_modules/.bin:$PATH" | |
export HUBOT_CAMPFIRE_TOKEN="token" | |
export HUBOT_CAMPFIRE_ROOMS="1,2,3,4" | |
export HUBOT_CAMPFIRE_ACCOUNT="subdomain" | |
export HUBOT_FOGBUGZ_HOST="some/fogbugz/server" | |
export HUBOT_FOGBUGZ_TOKEN="token" | |
export HUBOT_GITHUB_USER="gh_account" | |
export HUBOT_GITHUB_TOKEN="token" |
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
// Assume that we are not using a redis session store | |
// instead storing relevant information in redis. | |
// client side | |
// assume Cookie.get(name) returns the cookie | |
// this can use jQuery's cookie plugin or | |
// some regular expression on document.cookie | |
var socket = new io.Socket(); |
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
my_list = [('one','two',),('three','four',)] | |
return [first + second for first, second in my_list] | |
# ['onetwo', 'threefour'] |
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
def return_it(): | |
return ('first', 'second',) | |
one, two = return_it() | |
print one | |
# first | |
print two | |
# second |
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
brew upgrade | |
brew update | |
brew install cairo | |
brew install py2cairo | |
ln -s ~/Developer/lib/python2.7/site-packages/cairo ~/.virtualenvs/wpd/lib/python2.7/site-packages/cairo | |
# I needed to specify that my virtual environment uses python 2.7.3 because by default it used 2.7.2 | |
# but brew compiled py2cairo with 2.7.3 | |
mkvirtualenv --no-site-packages -p ~/Developer/bin/python wpd |
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
def xor(string, key): | |
data = '' | |
for char in string: | |
for ch in key: | |
char = chr(ord(char) ^ ord(ch)) | |
data += char | |
return data |
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 compressor.filters import CompilerFilter | |
class UglifyFilter(CompilerFilter): | |
command = "uglifyjs {infile} -o {outfile} -c -m" |
OlderNewer