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
# By twitter.com/j4mie | |
# | |
# Like this: http://blog.davidziegler.net/post/107429458/see-which-twitterers-don-t-follow-you-back-in-less-than | |
# ..but with API pagination (in case you have more than 100 friends or followers). | |
# Needs this: http://code.google.com/p/python-twitter/ | |
# ..which needs this: http://cheeseshop.python.org/pypi/simplejson | |
import twitter, getpass, sys | |
def page_function(function): |
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
Too big for a gist, converted to a full repository: http://github.com/j4mie/marvin/ |
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 | |
# Convert a directory of .markdown files to HTML and PDF. | |
# Requires: markdown and htmldoc | |
for i in $( ls *.markdown ); | |
do | |
echo Compiling $i | |
name=$( echo $i | sed 's/.markdown//' ) |
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
# Get website password at command line in Mac OS X | |
security 2>&1 >/dev/null find-internet-password -gs twitter.com | grep password | sed 's/password: "\(.*\)"/\1/' |
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
// A bookmarklet to extract the short 'flic.kr' url from a Flickr photo page, | |
// and display it in a prompt dialog box ready to be copied to the clipboard. | |
javascript:var links = document.getElementsByTagName('link'); for (link in links) { href=links[link].href; if (href && href.match('/flic\.kr/')) { prompt("flic.kr url:", href); }} |
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/python | |
# sqail by Jamie Matthews [email protected] | |
# 20th February 2009 | |
# "tail -f" an sqlite table - monitor all inserts | |
# Usage: ./sqail dbfile tablename | |
# Prints the rowid of the row followed by a colon, then a |
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
Command to check whether a server returns a different headers for a HEAD request than a GET. | |
site=http://www.facebook.com; diff <(curl -I ${site}) <(curl -i ${site} | sed '/^\r$/ q') |
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
# Concatenate a set of CSV files passed as arguments. The headers of all | |
# the files must match. Output will be a single header row, followed | |
# by all the rows from all the CSV files. | |
import sys | |
if len(sys.argv) == 1: | |
sys.exit("No arguments supplied") | |
buffer = [] |
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/python | |
import sys, random | |
if len(sys.argv) < 2: | |
print("Please supply number of letters to generate") | |
sys.exit(1) | |
try: | |
letters_to_generate = int(sys.argv[1]) | |
except: | |
print("Argument must be a number") |
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
# Print all permutations formed by concatenating every word in a | |
# list with every other word in the same list. Good for generating | |
# idea/project/company names from a list of relevant words. The list | |
# will be sorted by word length. | |
from itertools import permutations | |
words = "spam eggs beans".split() | |
perms = ["".join(permutation) for permutation in permutations(words, 2)] | |
print "\n".join(sorted(perms, lambda a, b: len(a) - len(b))) |
OlderNewer