Skip to content

Instantly share code, notes, and snippets.

View samv's full-sized avatar

Sam Vilain samv

View GitHub Profile
@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 / 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: [email protected]
Tracking number 5244371XXXXXXXX
Ship date Jan 29, 2013
Destination SAN FRANCISCO, CA
Estimated delivery 2013-01-31T00:00:00
Signed for by
@samv
samv / README.rst
Last active August 29, 2015 14:01
System info for System76 Pangolin Performance (panp9)
@samv
samv / gist:34c5013278bf5e36d9f9
Created May 22, 2014 21:13
Error building atom
Usage: gyp_main.py [options ...] [build_file ...]
gyp_main.py: error: no such option: --no-parallel
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 2
gyp ERR! stack at ChildProcess.onCpExit (/home/samv/oss/atom/build/node_modules/npm/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.11.0-20-generic
gyp ERR! command "node" "/home/samv/oss/atom/build/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
@samv
samv / yelpreview.txt
Last active April 5, 2016 17:30
Letter from a Dentist going out of business to patents: Screw The Perverted Incentives of Insurance Funded Dentistry! Screw some guy on Yelp 5 years ago! Screw free speed, the constitution and HIPPA! Screw it all, I'm starting a website
Dear Patients,
October 5, 2014
After nearly a decade of practice in the office I set up from scratch,
I have made the difficult decision to close my doors. This letter
will set forth the steps I have taken to ensure your continuity of
care, as well as steps for you to take. Additionally, because I care
deeply about you as patients, I will also share with you a high-level
overview of the series of events that led us to this point. It is my
@samv
samv / start-ssh-agent
Created February 19, 2015 19:36
Script to reattach a shell to SSH
#!/bin/sh
# this script knows how to look in /tmp/ssh-* for SSH agent sockets.
# These are created by the SSH agent, or for hosts you connected to
# with 'ssh -A' (or you set 'ForwardAgent yes' in your .ssh/config).
# the upshot is that if *any* of your current ssh connections have an
# agent connection, then you can run this script and it will set your
# environment variables up in the shell you are currently working in.
@samv
samv / output.txt
Last active August 29, 2015 14:20
Remove 'unknown' json fields
JsonRecord(unknown_json_keys={'foo': 'bar'})
JsonRecord()
@samv
samv / git-wcpush
Last active August 29, 2015 14:24
'git wcpush'
#!/bin/bash
remote=$1
ssh_target=$(git config remote.$remote.url)
echo "remote $remote, ssh is $ssh_target"
cdup="$(git rev-parse --show-cdup)"
if [ -n "$cdup" ]
then
@samv
samv / pr-blame.sh
Created January 3, 2016 04:00
Git Blame script that resolves revision numbers to GitHub PR #'s, remote tags, remote or local branches
#!/bin/bash
#
# call with '-i' to initialize the repo
self=$(basename "$0")
TEMP="$(getopt n:w:i "$@")"
eval set -- $TEMP
REFS="refs/pr/*"
WIDTH=10
@samv
samv / soap-request-2.xml
Last active May 24, 2016 05:35
ONVIF Response from Dahua IPC-HFW1200
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>admin</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">DG671R1pCZQXyMiFl04yxSY3dHg=</wsse:Password>
<wsse:Nonce>YSB2YWx1ZSBvZiA1MzY=</wsse:Nonce>
<wsu:Created>2016-05-24T05:29:58Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>