This file contains hidden or 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
| """mk2mpris.py: forward GNOME media key events to an MPRIS2 player. | |
| """ | |
| import dbus | |
| from dbus.mainloop.glib import DBusGMainLoop | |
| import gobject | |
| APP_NAME = 'mk2mpris' | |
| DBUS_INTERFACE_MK = 'org.gnome.SettingsDaemon.MediaKeys' | |
| OBJ_PATH_MK = '/org/gnome/SettingsDaemon/MediaKeys' | |
| OBJ_NAME_GSETTINGS = 'org.gnome.SettingsDaemon' |
This file contains hidden or 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
| 2 tone | |
| 2-step garage | |
| 4-beat | |
| 4x4 garage | |
| 8-bit | |
| acapella | |
| acid | |
| acid breaks | |
| acid house | |
| acid jazz |
This file contains hidden or 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
| """Simple scraper for LyricsWiki and Lyrics.com. The code is hacky and | |
| ugly because I wanted to implement this without a full-blown HTML parser | |
| like BeautifulSoup or lxml. | |
| """ | |
| import urllib | |
| import sys | |
| import re | |
| COMMENT_RE = re.compile(r'<!--.*-->', re.S) | |
| DIV_RE = re.compile(r'<(/?)div>?') |
This file contains hidden or 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 _make_id_getter(entity): | |
| def getter(id, **kwargs): | |
| includes = [] | |
| for name in kwargs: | |
| if not name.startswith('inc_'): | |
| raise TypeError('got unexpected keyword argument...') | |
| elif kwargs[name]: | |
| includes.append(name[4:]) | |
| return _do_mb_query(entity, id, includes) | |
| getter.__name__ = 'get_%s_by_id' % entity |
This file contains hidden or 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 couple of very simple utilities for reading and writing files | |
| that contain multiple JSON values. Could be useful in situations where | |
| you're generating a bunch of data for later processing and then, later, | |
| you want to read it in an element at a time. | |
| The json module doesn't really support streaming reads, though, so this | |
| is limited by that. If you need real streaming, you probably want to use | |
| something like ijson: | |
| http://pypi.python.org/pypi/ijson/ | |
| """ |
This file contains hidden or 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
| diff -r 6a862c34b61f fplib/CMakeLists.txt | |
| --- a/fplib/CMakeLists.txt Mon Jul 12 18:14:59 2010 +0100 | |
| +++ b/fplib/CMakeLists.txt Mon Jan 31 16:49:31 2011 -0800 | |
| @@ -19,6 +19,7 @@ | |
| IF(APPLE) | |
| INCLUDE_DIRECTORIES(/opt/local/include/) | |
| +LINK_DIRECTORIES(${LINK_DIRECTORIES} /opt/local/lib/) | |
| ENDIF(APPLE) | |
This file contains hidden or 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
| """Simple but robust implementation of generator/coroutine-based | |
| pipelines in Python. The pipelines may be run either sequentially | |
| (single-threaded) or in parallel (one thread per pipeline stage). | |
| This implementation supports pipeline bubbles (indications that the | |
| processing for a certain item should abort). To use them, yield the | |
| BUBBLE constant from any stage coroutine except the last. | |
| In the parallel case, the implementation transparently handles thread | |
| shutdown when the processing is complete and when a stage raises an |
This file contains hidden or 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
| """Plot time data from a Runmeter <http://www.abvio.com/runmeter/> | |
| data export.""" | |
| import csv | |
| import sys | |
| from collections import defaultdict | |
| import datetime | |
| def runmeter_read(path): | |
| doc = csv.reader(open(path)) |
This file contains hidden or 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 | |
| """Quickly get a temporary Ubuntu EC2 instance, SSH into it, and then | |
| terminate the instance on logout. | |
| """ | |
| import boto | |
| import subprocess | |
| import time | |
| # Set your AWS credentials. | |
| EC2_ACCESS = '' |
This file contains hidden or 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 | |
| """Aliases for argparse positional arguments.""" | |
| import argparse | |
| class AliasedSubParsersAction(argparse._SubParsersAction): | |
| class _AliasedPseudoAction(argparse.Action): | |
| def __init__(self, name, aliases, help): |