Skip to content

Instantly share code, notes, and snippets.

def get_cruise_type_ticket_type_price_id_by_cruise_type_id_and_ticket_type_id(cruise_type_id, ticket_type_id):
with session_scope() as session:
result = session.execute('''
SELECT id
FROM cruise_type_ticket_type
WHERE cruise_type_id = :cruise_type_id
AND ticket_type_id = :ticket_type_id
''', {
'cruise_type_id': cruise_type_id,
'ticket_type_id': ticket_type_id
@bmoore
bmoore / nodegit.sh
Created September 24, 2015 12:24 — forked from tbranyen/nodegit.sh
emscripten fallback
λ node
> require("nodegit").Repository.open(".", function(err, repo) { console.log(err, repo); });
0 {}
@bmoore
bmoore / Auth.php
Created July 2, 2012 15:29
The authentication library.
<?php
class Auth
{
private $hasher;
private $session;
function __construct()
{
$this->hasher = new PasswordHash(8, false);
@bmoore
bmoore / install.sh
Created December 7, 2012 21:08 — forked from padcom/install.sh
Gitorious installation on Ubuntu 12.04
#!/bin/bash
#------------------------------------------------------------------------------
# SETTINGS
#------------------------------------------------------------------------------
MYSQL_ROOT_PASSWORD=password
MYSQL_GITORIOUS_PASSWORD=password
GITORIOUS_HOST=gitorious
SYSADMIN=sysadmin
['1', 0.16689832213912348, 59.99709282775342, 'East of boundary.']
['1', 0.004260756905747937, 54.98549294460736, 'East of boundary.']
['1', 0.018806331058633906, 220.33702989450754, 'East of boundary.']
['1', 0.03657021257535287, 305.90667232816327, 'East of boundary.']
['1', 0.02785399075226293, 316.5604765542264, 'East of boundary.']
['1', 0.18427461167581766, 307.4794408936658, 'East of boundary.']
['1', 2.484245756716924, 306.97366543906054, 'East of boundary.']
['1', 2.4812818841756568, 309.3724846601186, 'East of boundary.']
['1', 2.4054561757813238, 270.46540583116104, 'East of boundary.']
['1', 1.5095238538513351, 313.03771807636167, 'East of boundary.']
0.166898322139,59.9970928278,Downstream
0.00426075690575,54.9854929446,Downstream
0.0188063310586,220.337029895,Downstream
0.0365702125754,305.906672328,Downstream
0.0278539907523,316.560476554,Downstream
0.184274611676,307.479440894,Downstream
2.48424575672,306.973665439,Downstream
2.48128188418,309.37248466,Downstream
2.40545617578,270.465405831,Downstream
1.50952385385,313.037718076,Upstream
# This tests whether the first point is east or west of the boundary
if (boundary[1] < point1[1]):
if (bearing < 30 and bearing > 230):
direction = 'Upstream'
else:
direction = 'Downstream'
else:
if (bearing < 270 and bearing > 120):
direction = 'Upstream'
@bmoore
bmoore / abr.sh
Created April 26, 2013 18:26
Android build and Ant debug install tool
#!/bin/bash
android update project --path ./
if [ $? -ne 0 ]
then
exit
fi
ant debug install
if [ $? -ne 0 ]
#!/bin/bash
# Usage: install_node 0.6.16
DIR=~/.node
TARGET=/Volumes/Macintosh\ HD
VER=$*
if [ ! -f ~/.node/$VER.pkg ]; then
curl --create-dirs -o $DIR/$VER.pkg http://nodejs.org/dist/v$VER/node-v$VER.pkg
fi
@bmoore
bmoore / upimg
Created May 28, 2013 18:02
Upload image selection to imgur, and pipe the image url to xclip. Based on http://sirupsen.com/a-simple-imgur-bash-screenshot-utility/
#!/bin/bash
function uploadImage {
curl -s -F "image=@$1" -F "key=486690f872c678126a2c09a9e196ce1b" https://imgur.com/api/upload.xml | grep -E -o "<original_image>(.)*</original_image>" | grep -E -o "http://i.imgur.com/[^<]*"
}
import shot.png
url=`uploadImage "shot.png"`
echo $url
echo $url | xclip -selection c