Skip to content

Instantly share code, notes, and snippets.

View bkeating's full-sized avatar
🤙
Gettin’ SUM & CALCin’ out

Benjamin Keating bkeating

🤙
Gettin’ SUM & CALCin’ out
View GitHub Profile
# Depends on the OS X "say" command
import time, datetime, subprocess, math, sys
def say(s):
subprocess.call(['say', str(s)])
def seconds_until(dt):
return time.mktime(dt.timetuple()) - time.time()
@bkeating
bkeating / howto-filemerge-git-osx.md
Created March 11, 2010 21:36
HOWTO: Using FileMerge (opendiff) with Git on OSX

HOWTO: Using FileMerge (opendiff) with Git on OSX

FileMerge (opendiff) can really come in handy when you need to visually compare merging conflicts. Other times it's just a nice visual way to review your days work.

The following method works by creating a simple bash script (git-diff-cmd.sh) that sets us up with the proper command line arguments for Git to pass off files to FileMerge.

# -*- coding: utf-8 -*-
import datetime as dt
import dateutil.parser as dparser
import urllib2
from BeautifulSoup import BeautifulSoup
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
print "<articles>"
# Loop through each prediction and bet URL.
@bkeating
bkeating / wordpress-wxr-example.xml
Created February 23, 2011 16:57
A vanilla example of the WordPress WXR Schema. Im using this as a starting point to build my own comments importer for disqus.com
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dsq="http://www.disqus.com/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/1.0/"
>
<channel>
<item>
<!-- title of article -->
@bkeating
bkeating / gunicorn_upstart.conf
Created September 13, 2011 17:17
An example of my Upstart script that can start/stop a Django project.
# PROJECT_NAME.conf - run PROJECT_NAME gunicorninstances
#
# This runs gunicorn_django for PROJECT_NAME; to install:
# * sudo ln -s <this file> /etc/init/PROJECT_NAME.conf
# * sudo initctl reload-configuration
# to use:
# * sudo start/stop/restart/reload/status PROJECT_NAME
#
# For a full list of configuration options: http://gunicorn.org/configure.html
@bkeating
bkeating / userprofile2mailchimp.py
Created January 3, 2012 23:26
Push Django UserProfile data to an existing MailChimp list
"""Iterate over User Profiles and push some fields to MailChimp.
This script assumes you already have a (lenghty) list setup on
mailchimp.com. It also assumes that you have a Django project utilizing
the Auth app and the User object's UserProfile (MemberProfile here).
It's all too custom to drop in and go, but have a look. This is how I
managed to push our Membership data into MailChimp. Learned a bunch of
stuff in the process.
@bkeating
bkeating / diary-example.md
Last active December 23, 2015 07:59
I use to keep a diary file as a single text file. Each note was separated by a datestamp. I wanted to break them out into their own individual text files so I wrote this with some help: http://stackoverflow.com/questions/18860441/split-diary-file-into-multiple-files-using-python/

Friday 02011-06-24 at 04:17:21 PM

Started new and improved diary file. Now in markdown format!

A good UNIX date string (used for my TextMate diary now macro):

date +"# %A 0%Y-%m-%d at %r"

Wednesday 02011-08-24 at 04-10-31 PM

@bkeating
bkeating / EastTroyComputerClubMeetup-001.md
Last active December 23, 2015 22:19
Notes, minutes and scratch space for the East Troy Computer Club's initial meetup. Please feel free to fork and expand on.

East Troy Computer Club Meetup Notes

Notes, minutes and scratch space for our initial meetup set to take place on Wednesday, September 25th, 02013 at 7pm to 8pm located at 2894 On Main (Cafe) on the historic East Troy town square. Many thanks to 2894 On Main for staying open extra late!

http://www.meetup.com/The-East-Troy-Computer-Club/

Club Hangouts

How about IRC?

  • Server: irc.freenode.org

East Troy Computer Club Meetup Notes

Notes, minutes and scratch space for our second meetup set to take place on Wednesday, October 16th, 02013 at 7pm to 8pm located at 2894 On Main (Cafe) on the historic East Troy town square. Many thanks to 2894 On Main for staying open extra late!

http://www.meetup.com/The-East-Troy-Computer-Club/

Club Hangouts (on and offline)

How about IRC?

  • Server: irc.freenode.org