Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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]
# 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