Skip to content

Instantly share code, notes, and snippets.

View tommeagher's full-sized avatar

Tom Meagher tommeagher

View GitHub Profile
import random
class Markov(object):
def __init__(self, open_file):
self.cache = {}
self.open_file = open_file
self.words = self.file_to_words()
self.word_size = len(self.words)
self.database()
@ryanpitts
ryanpitts / collect_facebook_stats.py
Created December 13, 2011 23:05
This script uses the Facebook API to fetch stats for a given list of URLs. We use it at year's end to compile a "most shared" story list.
"""
One of our editors thought it would be fun to run a year-end list of our
most-shared stories. This script uses the Facebook API to fetch stats for
a given list of URLs.
The script will:
- create a csv file that's named based on the value of TOP_URLS_FILE. This
file logs URLs that have enough shares to surpass your TOP_THRESHHOLD number.
@brianboyer
brianboyer / gist:1696819
Created January 29, 2012 02:21
Lion dev environment notes
@fcurella
fcurella / django_postgis_on_os_x.md
Created July 27, 2012 15:22
Django and Postgis on OS X

Django and Postgis on OS X

Install Homebrew

Install a few things with homebrew:

Notice that some packages give you information at the end, read it carefully. To recall that info use brew info like this: $ brew info postgresql

$ brew install python --universal
@yanofsky
yanofsky / LICENSE
Last active June 5, 2024 21:51
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@mikejcorey
mikejcorey / Getting memcached working for Django on OSX
Created September 4, 2013 20:16
Process for installying MemCached for use in Django apps on OS X
#Global stuff
#First, install memcached and libmemcached using homebrew. This may require gcc, which may require you to update your XCode if it's not up to date.
brew install memcached
brew install libmemcached
#Python stuff, inside your virtual environment
pip install pylibmc, etc.
@bertspaan
bertspaan / README.md
Created January 2, 2014 15:28
Python script to convert DBF database file to CSV
# These are shell functions to quickly create pansharpened RGB images ready for color correction
# from a set of raw Landsat 8 TIF files in a given directory.
# For example:
# l8_pansharp LC81690352014169LGN00
# Creates:
# LC81690352014169LGN00_rgb_pansharp.tif
# l8_rush_pansharp downloads a L8 tile from Google Storage (if they have it), extracts the relevant bands, then creates the pansharpened output.
class Document < ActiveRecord::Base
include HTTParty
format :json
base_uri "https://www.documentcloud.org"
debug_output $stdout # optional
def update_published_url
self.class.put("/api/documents/#{self.dc_id}.json",
basic_auth: {
username: ENV['DOCUMENTCLOUD_USERNAME'],