Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import os
class Spotipy:
"""
Provides a rudimentary interface to the Spotify player on OS X
Supports play/pause, next/previous, shuffle, repeat, volume_up/volume_down/mute commands.
Usage:
import spotipy
#!/usr/bin/python
"""
Provides a Python-compatible interface for the Apple Remote.
Requires this modified version of iremoted: http://github.com/swinton/iremoted.
Usage:
1. Install iremoted from http://github.com/swinton/iremoted along with this Python module.
2. Construct your source code like so:
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
# via http://www.geekology.co.za/blog/2009/02/mac-os-x-quick-tip-launch-screen-saver-with-bash-script-using-applescript/
tell application id "com.apple.ScreenSaver.Engine" to launch
# to interrupt screensaver:
#osascript -e 'tell application id "com.apple.ScreenSaver.Engine" to quit'
package dragdroptest;
import processing.core.PApplet;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.*;
package dropify;
import processing.core.PApplet;
import processing.core.PImage;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import java.io.BufferedReader;
import java.io.DataOutputStream;
#!/usr/bin/env python
"""
A quick-and-dirty method for grabbing tweets from Twitter retrospectively, using the Search API.
Searches for mentions of "thisisengland" in this instance...
"""
import urllib
import anyjson
#!/usr/bin/env python
import datetime
import getpass
import sys
import tweetstream
def tweets_per_min(user, passwd):
"""
Emits an estimated live "tweets per minute" metric every 5 seconds based on
#!/usr/bin/env python
import urllib
import anyjson
import nltk
import random
import twitter_text
import re
def generate_model(cfdist, word, word_count=10):
#!/usr/bin/env python
import cgi
import urlparse
import oauth2 as oauth
consumer_key = 'XXXX' # my key from twitter
consumer_secret = 'XXXX' # my secret from twitter
request_token_url = 'http://twitter.com/oauth/request_token'