Skip to content

Instantly share code, notes, and snippets.

View hugorodgerbrown's full-sized avatar

Hugo Rodger-Brown hugorodgerbrown

View GitHub Profile
@hugorodgerbrown
hugorodgerbrown / recursive_delete.sh
Last active October 8, 2015 14:57
Recursively delete files by type in Linux
find . -type f -name "*.pyc" -exec rm -f {} \;
@hugorodgerbrown
hugorodgerbrown / PS1 prompt replacement codes
Last active October 7, 2015 15:47
List of available bash PS1 prompt replacement codes
\a : an ASCII bell character (07)
\d : the date in "Weekday Month Date" format (e.g., "Tue May 26")
\D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
\e : an ASCII escape character (033)
\h : the hostname up to the first '.'
\H : the hostname
\j : the number of jobs currently managed by the shell
\l : the basename of the shell’s terminal device name
\n : newline
\r : carriage return
@hugorodgerbrown
hugorodgerbrown / thesaurus.py
Created July 18, 2012 07:02
Look up words using Big Huge Thesaurus API
'''
Command line script used to grab synonyms off the web using a thesaurus api.
The words come from the "Big Huge Thesaurus", and I make no claims about the
results. In order to use this script you will need a valid API key, which is
available, for free (up to 10,000 calls / day), from here - http://words.bighugelabs.com/getkey.php
If you're really lazy, you can just use my key - eb4e57bb2c34032da68dfeb3a0578b68
but I'd rather you didn't. Thanks.
Examples:
@hugorodgerbrown
hugorodgerbrown / Haymaker.py
Created April 9, 2012 22:22
Parses event details out from the Hay Festival website
from bs4 import BeautifulSoup
import json
import requests
import HTMLParser
class FestivalEvent(object):
pass
def cleanText(txt):
return txt.strip().replace(u'\u2013', '-').replace(u'\u2019', '\'')