Skip to content

Instantly share code, notes, and snippets.

View patrickhulce's full-sized avatar
😎
Live, eat, breathe JS

Patrick Hulce patrickhulce

😎
Live, eat, breathe JS
View GitHub Profile
@patrickhulce
patrickhulce / entry.js
Last active August 27, 2015 05:59
webpack intro
var webpack = require('webpack');
module.exports = {
entry: {
app: './entry.js'
},
output: {
path: __dirname,
publicPath: '/assets/',
filename: "[name].bundle.js"
@patrickhulce
patrickhulce / keymap.sublime-keymap
Created April 11, 2014 20:01
Sublime Home/End Fix OS X
[{
"keys": ["ctrl+a"],
"command": "move_cursor_beginning"
}, {
"keys": ["shift+ctrl+a"],
"command": "select_to_beginning"
}]
@patrickhulce
patrickhulce / server.py
Created February 18, 2015 04:16
304 Dummy Server
from wsgiref.simple_server import WSGIServer, WSGIRequestHandler
def echo(environ, start_response):
status = "304 Not Modified"
headers = [("Content-type", "application/json"), ("ETag", "asdf")]
start_response(status, headers)
return [""]
httpd = WSGIServer(('0.0.0.0', 80), WSGIRequestHandler)
httpd.set_app(echo)
@patrickhulce
patrickhulce / app.js
Last active August 29, 2015 14:20 — forked from Mithrandir0x/gist:3639232
Angular Patterns
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@patrickhulce
patrickhulce / sockets.py
Created April 7, 2013 05:23
Working with web sockets.
#!/usr/bin/env python
import socket, threading, time, re
from base64 import b64encode
from hashlib import sha1
def handle(s,a):
print a
handshake_data = s.recv(4096)
print handshake_data
client_key = re.search("Sec-WebSocket-Key:\s+(.*?)[\n\r]+", handshake_data).groups()[0].strip()
@patrickhulce
patrickhulce / siege.sh
Created February 4, 2016 21:13
siege POST
siege -c 20 -d 0 -H "Content-Type: application/x-www-form-urlencoded" -g 'http://localhost:3000/endpoint POST mydata=foo'
siege -c 20 -d 0 -H "Content-Type: application/json" -g 'http://localhost:3000/endpoint POST {"key": "value"}'
@patrickhulce
patrickhulce / go.sh
Last active August 5, 2016 21:48
Basic Ubuntu Express Setup
# First, install Ubuntu 16 LTS (http://www.ubuntu.com/download/desktop) and open a terminal
# sudo means 'do this thing as the superuser', apt-get is a way to install software, nodejs and npm are two software packages you'll need
sudo apt-get install nodejs npm
# Creates the directory 'myfirstserver'
mkdir myfirstserver
# Changes the current directory to myfirstserver
cd myfirstserver
@patrickhulce
patrickhulce / docker_cleanup.sh
Created October 30, 2016 16:09
Docker Cleanup
docker rmi $(docker images | grep "^<none>" | awk '{print $3}') # Remove all untagged images
docker rm $(docker ps -a | grep -E '^[a-f0-9]+\s+[a-f0-9]+\s' | awk '{print $1}') # Remove all containers running untagged images
@patrickhulce
patrickhulce / dcraw.c
Created November 12, 2016 22:56
dcraw.c
/*
dcraw.c -- Dave Coffin's raw photo decoder
Copyright 1997-2016 by Dave Coffin, dcoffin a cybercom o net
This is a command-line ANSI C program to convert raw photos from
any digital camera on any computer running any operating system.
No license is required to download and use dcraw.c. However,
to lawfully redistribute dcraw, you must either (a) offer, at
no extra charge, full source code* for all executable files