Skip to content

Instantly share code, notes, and snippets.

@egradman
egradman / copy_rich_text
Created January 31, 2023 00:51
Copies the current document to the Mac clipboard. It preserves formatting, because it uses pandoc/HTML as an intermediate step.I use https://github.com/Taitava/obsidian-shellcommands
#!/usr/bin/env python3
import sys
import re
import os
import tempfile
import shutil
import uuid
from subprocess import Popen, PIPE, STDOUT
@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.
# 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:1d42a5a826fa6339fa1ab7af27b3309d
Created August 17, 2021 00:08
generate LAUSD daily_pass
# create a file named .env containing:
#username=<username>
#password=<password>
#student_id=<student_id>
#facility_id=<facility_id>
#find the facility id by inspecting the page once you've selected your school
from selenium import webdriver
from selenium.webdriver.common.by import By
@egradman
egradman / # gazebo9 - 2020-09-14_21-57-47.txt
Created September 15, 2020 05:20
gazebo9 (osrf/simulation/gazebo9) on macOS 10.14.6 - Homebrew build logs
Homebrew build logs for osrf/simulation/gazebo9 on macOS 10.14.6
Build date: 2020-09-14 21:57:47
@egradman
egradman / # gazebo9 - 2020-09-12_22-50-48.txt
Created September 13, 2020 06:15
gazebo9 (osrf/simulation/gazebo9) on macOS 10.14.6 - Homebrew build logs
Homebrew build logs for osrf/simulation/gazebo9 on macOS 10.14.6
Build date: 2020-09-12 22:50:48
@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:
@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 / 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;