Skip to content

Instantly share code, notes, and snippets.

View tacaswell's full-sized avatar

Thomas A Caswell tacaswell

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
sys.setrecursionlimit(10000)
class Meta(type):
def __new__(*args, **kwargs):
print('I will not use metaclasses just for the fun of using them', end=' ')
magic_count = kwargs.pop('__magic_count', 0)
if magic_count > 1000:
return type.__new__(*args, **kwargs)
Meta.__new__(__magic_count=magic_count+1, *args, **kwargs)
@tacaswell
tacaswell / tupper.ipynb
Last active August 29, 2015 14:19
Notebook demonstrating Tupper's Self-Referential Formula
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tacaswell
tacaswell / jsonschema_play.py
Created January 31, 2015 02:43
jschema_play
from jsonschema import validate
schema = {
"definitions": {
"data_key": {
"properties": {
"external": {
"type": "string",
"pattern": "^[A-Z]+:?"
},
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tacaswell
tacaswell / demo.py
Last active August 29, 2015 14:06
pandas play
import pandas as pd
from datetime import datetime, timedelta
dt = timedelta(seconds=1)
base_time = datetime(2014, 9, 24, 10, 5, 30)
indx1 = [base_time + j * dt for j in range(0, 10)]
indx2 = [base_time + j * dt for j in range(0, 10, 2)]
ds1 = pd.Series(5, index=indx1)
@tacaswell
tacaswell / .condarc
Created September 4, 2014 21:59
condarc_for_travis
channels:
- tacaswell
- defaults
from vistrails import api
csv = api.add_module(100, 100, 'org.vistrails.vistrails.tabledata', 'CSVFile', 'read')
fd = api.add_module(65, 50, 'org.vistrails.vistrails.url', 'DownloadFile', '')
api.add_connection(fd.id, 'file', csv.id, 'file')
api.change_parameter(fd.id, 'url',['http://www.vistrails.org/download/download.php?type=DATA&id=citibike_from_launch.csv'])