Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠

Paul Serraino paulserraino

🤠
View GitHub Profile
View javascript.json
{
"log": {
"prefix": "log",
"body": "console.log('${0}');",
"description": "Log output to console"
},
"import": {
"prefix": "impo",
"body": "import ${1} from '${2}';${0}",
"description": "Creates es6 import"
@paulserraino
paulserraino / flow.py
Created May 21, 2017
Predicting Vehicle Motion and Direction using Optical Flow
View flow.py
import cv2
import numpy as np
cap = cv2.VideoCapture('driving_sf.mp4')
# Util functions
def dist(a, b):
return np.sqrt(np.power(b[0] - a[0], 2) + np.power(b[1] - a[1], 2))
@paulserraino
paulserraino / b24.sh
Created May 20, 2016
Bandit level 24 one liner
View b24.sh
#!/bin/bash
for x in {0..9}{0..9}{0..9}{0..9}; do echo "pin $x"; echo "UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ $x" | nc localhost 30002 2>&1 | grep -A1 Cor.* && break; done
@paulserraino
paulserraino / heapsort.js
Last active Feb 14, 2016
Heapsort implementation using immutable data structures
View heapsort.js
function heapsort(list) {
var h = heapify(list);
return h.reduce((state, listItem, index) => {
return [
...state.slice(0, index + 1),
...heapify(state.slice(index + 1))
]
}, h)
}
@paulserraino
paulserraino / review.sh
Last active Nov 11, 2015
automating my goodybag review process
View review.sh
#!/usr/bin/env bash
# ./review.sh [branch id]
#example.
# ./review.sh 1947
if [ "$GITHUB_TOKEN" == "" ] ; then
echo "Error! You need to set GITHUB_TOKEN environment variable!"
exit 1
@paulserraino
paulserraino / atx_coffee_pw.md
Last active Aug 29, 2015
Coffee Shop Passwords Austin, Tx
View atx_coffee_pw.md

Coffee Shop Passwords

Name                           Password
-----------------------------------------------
Corona Cafe                    luckycharms
Houndstooth Coffee             coffeeandcheese

Brew & Brew coffeeandbeer

@paulserraino
paulserraino / app.js
Last active Aug 29, 2015
Updating a collection of child components
View app.js
var React = require('react');
/**
* Input
*/
var Input = React.createClass({
getInitialState: function () {
return { name: this.props.name || '' }
},
@paulserraino
paulserraino / work_repl.js
Created Jun 29, 2015
sample custom node repl
View work_repl.js
var repl = require('repl');
var path = require('path');
var r = repl.start();
require('repl.history')(r, path.join(process.env.HOME, '.node_history');
var caterDir = '../cater-api-server' || process.argv[2];
r.context.models = require(path.join(caterDir, 'models');
@paulserraino
paulserraino / default_eval.js
Created Jun 29, 2015
default eval from node core
View default_eval.js
var repl = require('repl');
var debug = require('debuglog');
var vm = require('vm');
// copy pasta from node source
// lib/repl.js
function defaultEval(code, context, file, cb) {
var err, result;
// first, create the Script object to check the syntax
try {
@paulserraino
paulserraino / test.js
Last active Aug 29, 2015
testing secure routes
View test.js
var assert = require('assert')
var request = require('request')
describe('My API', function () {
// initialize request cookie jar
request = request.defaults({ jar: request.jar() })
var cred = {
username: 'foo'