Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View samv's full-sized avatar

Sam Vilain samv

View GitHub Profile
@samv
samv / fedextrackingupdate.txt
Last active December 12, 2015 00:39
update email from Fedex. Note the use of ISO-8601 style in "Estimated Delivery": no suffix like "Z" or "-8" to indicate the time zone. Also, the "Tracking results as of ..." text is in GMT, but doesn't say that :-). Dates in the log appear to be local time (PST). Lack of alignment due to the bad use of hard tabs in the email. There is a log line…
-----------------------------------------------------------------------
This tracking update has been requested by:
Name: Anonymous
E-mail: sam@vilain.net
Tracking number 5244371XXXXXXXX
Ship date Jan 29, 2013
Destination SAN FRANCISCO, CA
Estimated delivery 2013-01-31T00:00:00
Signed for by
@samv
samv / gist:3941248
Created October 23, 2012 20:15
functions and columns are equivalent
svilain=# create table f (foo int);
CREATE TABLE
svilain=# create or replace function bar(f) returns int language sql as $$ select $1.foo + 10 $$;
CREATE FUNCTION
svilain=# insert into f values (1), (2);
INSERT 0 2
svilain=# select f.foo, f.bar from f;
foo | bar
-----+-----
1 | 11
@samv
samv / shell.py
Created August 13, 2012 19:38
A proposal for a SQLAlchemy Shell
"""
The SQLAlchemy Shell.
This is just a wrapper for code.InteractiveConsole with some useful
defaults for using SQLAlchemy
"""
import os
import sys
from code import InteractiveConsole
@samv
samv / x.txt
Created July 25, 2012 16:30
Reply to David
Hey David, they're quite specific with the sharkfest requirements
that the entry speed of 40min/mile is a pool time so I think you
should be fine without having a timed open water run. I've
uploaded the recent open water swims that I've done to RunKeeper
(using my Timex Global Trainer, under my swim cap), and they
show that my speed in choppy open water, wearing a wetsuit is
about 120s/100y (even though I *can* swim as fast as 90s/100y on
a sprint in a pool, even long course, that's not far off my
"easy" pace).
@samv
samv / exception.txt
Created May 11, 2012 18:32
How fucked is my code stack
An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug. Details: ------- org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getIssueCountByFixForVersion' in class com.atlassian.jira.plugin.projectpanel.impl.VersionDrillDownRenderer$RoadMapGraphingBean threw exception class com.atlassian.jira.issue.index.SearchUnavailableException : com.atlassian.util.concurrent.LazyReference$InitializationException: com.atlassian.jira.util.RuntimeIOException: java.io.FileNotFoundException: /data/jira/home/caches/indexes/issues/segments_apox (Too many open files)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:251)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:327)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:51)
at org.apache.velocity.runtime.parser.node
@samv
samv / Orange.itermcolors
Created March 24, 2012 22:13
Sam's iTerm colors, taken from the X11/rgb.txt palette
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
@samv
samv / output-2.txt
Created March 14, 2012 00:28
Program which uses a slave celery
$ rm celery*; nosetests -s -v tests/test_simplified.py
test_01_task (test_simplified.TestAsync) ... foo_our_task is: <@task: test.task>
assigned!
thread is: <Thread(Thread-1, initial)>
Worker ('worker0') running!
thread is: <Thread(Thread-1, started 4456366080)>
our_task is this time: <@task: test.task>
celery@worker0 has started.
result is :<AsyncResult: 7e42d3b4-0be5-4f48-8c7d-b305a78591a8>
We're in foo_our_task! Returning 'foo bar'
@samv
samv / gamble.py
Created February 26, 2012 18:43
Gambler's win
import random
cups = 3
i = 0
keeping_wins = 0
changing_wins = 0
while i < 1000:
i += 1
@samv
samv / countries.yaml
Created December 29, 2011 19:15
Country codes in pi
---
Abkhazia:
7840: 1
7940: 1
99544: 1
Afghanistan:
93: 1
Albania:
355: 1
Algeria:
22:25 < mugwump> dbugger: here's an example of how SQLAlchemy does it, for
inspiration:
http://readthedocs.org/docs/sqlalchemy-migrate/en/latest/#user-guide
22:28 < Harzilein> dbugger: here is a thread that mentions plans for schema
migration for typo3:
http://lists.typo3.org/pipermail/typo3-team-core-v5/2009-July/000349.html