Skip to content

Instantly share code, notes, and snippets.

View colejhudson's full-sized avatar
🏎️
gotta go faster

Cole Hudson colejhudson

🏎️
gotta go faster
View GitHub Profile
@colejhudson
colejhudson / reverse-proxy.sh
Created April 25, 2018 22:53
Simple Protocol Independent Reverse Proxy
#!/usr/bin/env bash
function proxy() {
local PUBLIC_PORT="80"
local LOCAL_HOST="127.0.0.1"
local LOCAL_PORT="8080"
mkfifo socket
sudo nc -kl ${1=PUBLIC_PORT} 0<socket | nc ${2=LOCAL_HOST} ${3=LOCAL_PORT} 1>socket
rm socket
@colejhudson
colejhudson / html-tags-ordered-by-attribute.json
Created April 27, 2018 03:30
JSON array of HTML tags indexed by their associated attributes
[
{
"attribute": "accept",
"tags": [
"<form>",
"<input>"
]
},
{
"attribute": "accept-charset",
@colejhudson
colejhudson / Makefile
Last active April 28, 2018 22:33
Realtek PCI Express Gigabit Ethernet Driver for Linux 4.7 and up - RTL8111H(S)/RTL8118/RTL8119i
################################################################################
#
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
# controllers with PCI-Express interface.
#
# Copyright(c) 2014 Realtek Semiconductor Corp. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
/* Schrodinger equation explorer */
/* Michael Creutz */
/* [email protected] */
/* to compile: */
/* cc -O -L/usr/X11R6/lib schrodinger.c -lX11 -lm */
/* this solves the Schrodinger equation in a potential */
/* displays amplitude squared and the potential superposed */
function nameof -a pid
pidof | grep $pid | awk '{ print $3 }'
end
set n 0
function find-leaks
sudo echo (printf "%*s" 4 "id")" | "(printf "%*s" 25 "name")" | "(printf "%*s" 10 "pid")" | "(printf "%*s" 5 "found leak?")
for pid in (ps aux | grep -v root | awk '{ print $2 }' | sed '1d;p' | head -n 100)
@colejhudson
colejhudson / macos-ocaml-num.md
Created January 28, 2019 08:55
ocamlfind issues on macOS

On macOS when you switch between versions of ocaml, or otherwise are having issues with ocamlfind, usually the reason has to do with that homebreww installed the num packaged separately and is a dependency of many packages, hence you also need to install or switch to the appropriate version for it using homebrew, the appropriate package name is ocaml-num.

@colejhudson
colejhudson / gist:4b7528c5f989e75ea335dd6131e47a7c
Created January 31, 2019 21:11
Last commit to Rust before the ML compiler was removed
https://github.com/rust-lang/rust/tree/5679f5c55e15e4a42542c36b1abc86b469903d19
global _main
section .text
_main:
mov ecx, ebx
add ebx, eax
mov eax, ecx
loop _main
global _main
section .text
_main:
mov eax, edi
ret