Skip to content

Instantly share code, notes, and snippets.

View bpollack's full-sized avatar

Benjamin Pollack bpollack

View GitHub Profile
$env:Path=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
@bpollack
bpollack / notajoke.py
Created March 27, 2015 18:52
My Favorite Python ORM
db = sqlite3.connect(path_to_db)
db.row_factory = sqlite3.Row
def q(db, query, args=(), one=False):
cur = db.execute(query, args)
rv = cur.fetchall()
return (rv[0] if rv else None) if one else rv
def c(db, query=None, args=(), one=False):
if query:

Keybase proof

I hereby claim:

  • I am bpollack on github.
  • I am benjamin (https://keybase.io/benjamin) on keybase.
  • I have a public key whose fingerprint is 7A77 6742 032D A415 0972 E98B D3F8 F6E7 40D1 13FA

To claim this, I am signing this object:

@bpollack
bpollack / setgopath.fish
Created October 28, 2013 14:19
setgopath for fish shell
function setgopath -d "Set the GOPATH to the current directory, and add its /bin to the PATH"
if [ -n "$GOPATH" ]
for x in (seq (count $PATH))
if [ $PATH[$x] = "$GOPATH/bin" ]
set clear $x $clear
end
end
for x in $clear
set -e PATH[$x]
end