Skip to content

Instantly share code, notes, and snippets.

View uogbuji's full-sized avatar

Uche Ogbuji uogbuji

View GitHub Profile
@uogbuji
uogbuji / akara.conf
Created February 28, 2011 19:35
My local akara.conf for dev/debugging on my Mac
# -*- mode: python -*-
# This is the main Akara server configuration file. It contains
# settings for the server and for its extension modules.
# The configuration file is written in Python. Configuration data goes
# into class attributes. If the module is "A.B.C" then the
# configuration information should be in the class named "C". If there
# is a conflict then use the parameter "akara_name" to set the full
# module name.
@uogbuji
uogbuji / rhythmbox_playlist.py
Created December 28, 2010 08:01
Puts out a plain text list of files in a Rhythmbox playlist (buried in XML). Uses Amara
'''
RhythmBox Play lister, Amara 2.x demo ( http://wiki.xml3k.org/Akara/ )
python rhythmbox_playlist.py ~/.local/share/rhythmbox/playlists.xml "Butters" ".ogg" | xargs -d "\n" ogg2mp3 -B 192 --vbr-new -V 0
'''
import sys
from itertools import groupby
@uogbuji
uogbuji / gruber_urlintext.py
Created November 18, 2010 18:28
John Gruber's regex to find URLs in plain text, converted to Python/Unicode
#See: http://daringfireball.net/2010/07/improved_regex_for_matching_urls
import re, urllib
GRUBER_URLINTEXT_PAT = re.compile(ur'(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?\xab\xbb\u201c\u201d\u2018\u2019]))')
for line in urllib.urlopen("http://daringfireball.net/misc/2010/07/url-matching-regex-test-data.text"):
print [ mgroups[0] for mgroups in GRUBER_URLINTEXT_PAT.findall(line) ]