Skip to content

Instantly share code, notes, and snippets.

# copyright 2010 Eric Gradman
# free to use for any purpose, with or without attribution
# from an algorithm by James McNeill at
# http://playtechs.blogspot.com/2007/04/hex-grids.html
# the center of hex (0,0) is located at cartesian coordinates (0,0)
import numpy as np
# R ~ center of hex to edge
@egradman
egradman / gist:675103
Created November 13, 2010 05:11
calendar code
import time
import atom
import gdata
import gdata.calendar
import gdata.calendar.service
def GetCalendarByTitle(calendar_service, title):
feed = calendar_service.GetAllCalendarsFeed()
calendar = [entry for entry in feed.entry if entry.title.text == title][0]
@egradman
egradman / redis-servefile
Created December 10, 2010 01:24
serve a redis dump.rdb file on the specified port
#!/bin/sh
# redis-servefile port filename
# serves a redis dump.rdb file on the specified port
port=$1
file=$2
rundir=`mktemp -d`
ln -s $file $rundir
@egradman
egradman / VideoSpriteBatchNode.h
Created April 26, 2011 23:39
cocos2d video sprite (batch node)
@interface VideoSpriteBatchNode: CCSpriteBatchNode
{
AVURLAsset *asset;
AVAssetTrack *videoTrack;
AVAssetReader *assetReader;
AVAssetReaderTrackOutput *trackOutput;
}
@property(nonatomic,retain) AVURLAsset *asset;
@property(nonatomic,retain) AVAssetTrack *videoTrack;
@property(nonatomic,retain) AVAssetReader *assetReader;
@egradman
egradman / gist:1505388
Created December 21, 2011 09:34
tropo python webapi coroutines
import tropo
coroutines = {}
def prompt_text(self, prompt, number):
"""
initiate a conversation with <phone>, asking a prompt
(merely pings the outbound session endpoint)
"""
@egradman
egradman / print_win32_vector.py
Created August 28, 2012 22:53
print_win32_vector.py which fixes scale factor for ULS M300 et al.
#!/usr/bin/env python
'''
print_win32_vector.py
This extension will generate vector graphics printout, specifically for Windows GDI32.
Copyright (C) 2012 Alvin Penner, penner@vaxxine.com
This is a modified version of the file dxf_outlines.py by Aaron Spike, aaron@ekips.org
It will write only to the default printer.
The printing preferences dialog will be called.
@egradman
egradman / cross-compile raspberry pi openframeworks
Created February 20, 2014 21:18
Cross-compiling OpenFrameworks 0.8 for Raspbian
# cross-compile raspberry pi openframeworks
Tested for my setup:
- Ubuntu 12.04 32-bit
- 2014-01-07-wheezy-raspbian
- OpenFrameworks 0.8 (release)
- My Pi is NFS booting from the Ubuntu box, FWIW.
Follow the directions here:

Dear Everybody

An Open Letter to Everybody

Dear Everybody with whom I've ever communicated by email on the Internet. I am an asshole. Though you probably received an email purportedly from me exhorting you to check out my profile on LinkedIn, I did not send it. When I have received similar letters in the past, I've deleted them, and scoffed at the sender.

Please do NOT check out my profile on LinkedIn. I don't want you to see it. In fact, by the time you read this it will probably be gone.

Phones in pockets can do all sorts of funny things. I've pocket dialed people before. Everybody has. But I've never pocket emailed thousands of people before. That could only happen with an app written by a company with a complete lack of responsibility when it comes to personal data.

@egradman
egradman / sample.ipynb
Last active November 2, 2022 04:59
Simple Google Spreadsheets to Pandas DataFrame in IPython Notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class Debouncer {
public:
int debounce_delay;
long high_edge_interval;
long last_transition_at;
bool last_val;
bool last_state;
bool state;