Skip to content

Instantly share code, notes, and snippets.

View hugorodgerbrown's full-sized avatar

Hugo Rodger-Brown hugorodgerbrown

View GitHub Profile
@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', '\'')
@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 / 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 / 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 / trello-comments.py
Created September 21, 2012 11:16
Fetch latest comments from a Trello board
import datetime
import requests
BOARD_ID = '505a39b96cd440be5a3ba732'
DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%fz'
# trello api bits - get your own - https://trello.com/1/appKey/generate
API_KEY = '0e62df80c39cd97ef936c405d83b0a23'
API_TOKEN = '45ba8a4f47f4f2290695890464380024ef6852b9fed96dc620dea343bee79ba2'
@hugorodgerbrown
hugorodgerbrown / gist:4011735
Created November 4, 2012 12:41
Git pimping scripts
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
# pretty, coloured, graph visualisation - taken from http://stackoverflow.com/a/9074343/45698
git config --global alias.lg1 "log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative"
# pretty, coloured, graph visualisation - taken from http://stackoverflow.com/a/9074343/45698
git config --global alias.lg2 "log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit"
# add alias to create simple changelog
# usage: git clog <commit_hash>..HEAD
@hugorodgerbrown
hugorodgerbrown / changelog.md
Last active September 7, 2016 10:57
Last 10 deployments to yunojuno.com, automatically generated on Wednesday, 07-Sep-2016

v1482, deployed on Tuesday, 06-Sep-2016

  • Add specificity to where the search results should be added
  • Fix test regression related to button markup change
  • Disable opbeat async for rqworkers in Procfile
  • changed copy on post-onboarding onboarding tasks
  • Add opbeat logging support to RQ jobs.
  • Paginate todos page backoffice.
  • fixed admin buttons on fl profile & cleared out DS templates
  • Remove old invite response email
@hugorodgerbrown
hugorodgerbrown / bash shortcuts
Created January 24, 2013 12:11
Bash shortcut key combos.
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
Ctrl + Z Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W Delete the word before the cursor
@hugorodgerbrown
hugorodgerbrown / md_to_rst.sh
Last active March 26, 2023 16:57
Shell script for converting a batch of *.md files into *.rst using pandoc.
# This script was created to convert a directory full
# of markdown files into rst equivalents. It uses
# pandoc to do the conversion.
#
# 1. Install pandoc from http://johnmacfarlane.net/pandoc/
# 2. Copy this script into the directory containing the .md files
# 3. Ensure that the script has execute permissions
# 4. Run the script
#
# By default this will keep the original .md file
@hugorodgerbrown
hugorodgerbrown / remove_tags.sh
Last active January 12, 2021 21:28
Git - remove all remote tags
# Sometimes tags get out of control - git apps (Tower, SourceTree, Github) can often add
# tags automatically (e.g. when merging branches) and over time your remote repo can become
# cluttered with irrelevant tags. The easiest way to clean this up is to get your local
# repo in order, delete all the remote repo tags, and then repush from local.
# Dump all local tags into a text file
git tag -l > tags.txt
# Remove all the tags you want to keep, leaving only those for deletion.
[vim | emacs | micro | sublime | ...] tags.txt
# Delete all the tags that are left