Skip to content

Instantly share code, notes, and snippets.

View djm's full-sized avatar

Darian Moody djm

View GitHub Profile
@djm
djm / gae_shell.py
Created September 28, 2014 12:20
Google App Engine Development Shell
#!/usr/bin/env python -i
"""
A local interactive IPython shell for Google App Engine on Mac OSX.
Usage:
cd /to/project/folder/with/app.yaml
python gae_shell.py
Notes:
@djm
djm / dl.py
Created July 19, 2014 13:03
Download all from imgur embed URL
import os
import sys
from os.path import basename, splitext
from urlparse import urlparse
import requests
from bs4 import BeautifulSoup
def extract_full_size_url_from_tag(image_tag):
@djm
djm / human_readable.py
Last active January 3, 2016 10:59
Convert Programming Cased strings to a Human Readable one
import re
def camelcase_to_human_readable(camel_cased_string):
""" Converts a string from CamelCase to Human readable.
e.g SuperBadRobot -> Super Bad Robot
"""
return ' '.join(re.findall("([A-Z][^A-Z]*)", camel_cased_string)).strip()
@djm
djm / retrieve_dict.py
Last active December 30, 2015 00:19
Retrieve a list of a Scrapy project's spiders via Python
# Works on Scrapy v0.20
from scrapy.crawler import Crawler
from scrapy.utils.project import get_project_settings
def get_spiders():
""" Retrieves a dict of the spiders classes available to the current
scrapy keyed by their string-name.
"""
settings = get_project_settings()
@djm
djm / cron
Last active December 17, 2015 09:58
Cron one liners for virtualenv based django management commands
# I mean this:
* */12 * * * /path/to/virtualenv/bin/python /path/to/django/project/manage.py cleanup
# over this:
* */12 * * * source /path/to/virtualenv/bin/activate; /path/to/django/project/manage.py cleanup
@djm
djm / itunes-to-feed-url-bookmarklet.js
Created April 22, 2012 17:05
Bookmarklet: Convert iTunes Store Podcast URL into actual feed URL
(function() {
/* Bookmarklet that displays the actual podcast feed
* URL when ran on an iTunes store page for a podcast.
*
* Simply grabs the Artist ID from the URL and does
* an iTunes Store API lookup to get the hidden (original)
* podcast feed URL (whatever format that may be in).
*
* @author: Darian Moody <mail@djm.org.uk>
* @date: Working as of Sun.22.Apr.2012