Skip to content

Instantly share code, notes, and snippets.

View myles's full-sized avatar
🦖

Myles Braithwaite myles

🦖
View GitHub Profile
/**
* Implementation of hook_block().
*
* Displays the most recent 10 blog titles.
*/
function blog_block($op = 'list', $delta = 0) { global $user; if ($op == 'list') {
$block[0]['info'] = t('Recent blog posts');
return $block;
} else if ($op == 'view') {
if (user_access('access content')) {
@myles
myles / pull_list.py
Created April 11, 2011 19:03
A simple script that scrapes your Pull List from ComiXology.
#!/usr/bin/env python
"""
A simple script that scarpes your Pull List from ComiXology.
HOWTO:
$ python pull_list.py mylesb
Daken: Dark Wolverine #8
Hellboy: Buster Oakley Gets His Wish
The Li'l Depressed Boy #3
@myles
myles / twitter_list_to_opml.py
Created June 28, 2011 16:24
A simple python script that creates an OPML file of a Twitter user's lists.
#!/usr/bin/env python
"""
A simple script that creates an OPML file of the RSS feeds to
a Twitter user's lists.
python twitter_list_to_opml.py mylesb
Copyright (c) 2010, Myles Braithwaite <me@mylesbraithwaite.com>
All rights reserved.
#!/bin/bash
# This will copy a file, appending the date and time
# to the end of the file name.
#
# http://c.myl.be/8BYj
date_formatted=$(date +%Y-%m-%d_%H.%M%S)
file_extension=`echo "$1"|awk -F . '{print $NF}'`
file_name=`basename $1 .$file_extension`
@myles
myles / gob_program.py
Created July 11, 2011 18:27
Gob Program
#!/usr/bin/env python
import sys
def main():
print "Gob's Program: y/n?"
yesorno = raw_input()
if yesorno.lower()[0] == 'y':
@myles
myles / tumblr.py
Created September 2, 2011 16:50
A Read Only Tumblr Python library for their version 2 API.
"""
A Read Only Tumblr Python library for their version 2 API.
Requires a Tumblr API Key and httplib2.
Copyright (c) 2010, Myles Braithwaite <me@mylesbraithwaite.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@myles
myles / AddLineInTextFileAsTasks.scpt
Created April 4, 2012 15:51
Text File to Things Task using Dropbox and Hazel
tell application "Things beta"
set fileContents to read theFile using delimiter {linefeed}
repeat with currentLine in reverse of fileContents
set newToDo to make new to do with properties {name:currentLine}
end repeat
end tell
@myles
myles / gtalug_ics.py
Last active March 22, 2019 12:11
A simple Python script that generates the GTALUG ICS (or iCal) file at <http://gtalug.org/gtalug.ics>.
#!/usr/bin/env python
import vobject
import datetime
from pytz import timezone
from dateutil import rrule
TIME_ZONE = timezone('US/Eastern')
TODAY = datetime.date.today() - datetime.timedelta(days=31)
MEETING_START_TIME = datetime.time(19, 30, tzinfo=TIME_ZONE)
@myles
myles / gist:5503047
Created May 2, 2013 15:33
Rewrite a root directory to a subdirectory (i.e. /index.html -> /subdir/index.html).
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/subdir
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ subdir/$1 [L]
@myles
myles / qrcode.html
Last active December 23, 2015 04:49
QR Code for Django - Appends a /qr/ to all your urls with a QR code generated by Google Charts.
<!DOCTYPE html>
<html>
<head></head>
<body>
<img src="//chart.googleapis.com/chart?cht=qr&amp;chs=177x177&amp;ch1={{ url|urlencode }}">
</body>
</html>