Skip to content

Instantly share code, notes, and snippets.

View mikesmullin's full-sized avatar
🛴
woot!

Mike Smullin mikesmullin

🛴
woot!
View GitHub Profile
@mikesmullin
mikesmullin / tcpflow-1.4.4_wrapper.coffee
Last active November 8, 2017 11:42
wrapper for tcpflow which enhances its stdout output to include easily parsed timestamp format, incl. milliseconds, tz offset, and packaged in flat json one-object-per-row ideal for mapreducing on
#!/usr/bin/env coffee
#
# install on ubuntu:
# sudo apt-get install automake autoconf libpcap-dev zlib1g-dev libboost-dev libcairo2-dev
#
# cd /tmp/
# git clone --recursive -b tcpflow-1.4.4 git@github.com:simsong/tcpflow.git tcpflow/
# cd tcpflow/
#
# sh bootstrap.sh
@mikesmullin
mikesmullin / arc4.coffee
Last active August 29, 2015 14:00
A CoffeeScript implementation of RC4
# A CoffeeScript implementation of RC4
class ARC4
i: 0
j: 0
psize: 256
S: null
constructor: (key=null) ->
@S = new Buffer(@psize)
if key
@init key
@mikesmullin
mikesmullin / vboxmanage.bat
Created January 12, 2014 18:28
virtualbox vboxmanage commands equivalent to vagrant (or even better, borg)
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" help import
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list natnets
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo "sfs01"
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list dhcpservers
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" natnetwork stop -t NatNetwork
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" natnetwork start -t NatNetwork
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" dhcpserver add --netname xm_slc_routed --ip 172.16.2.1 --netmask 255.255.0.0 --lowerip 172.16.2.4 --upperip 172.16.2.254 --enable
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" dhcpserver modify --netname xm_slc_routed --ip 172.16.0.1 --netmask 255.255.0.0 --lowerip 172.16.0.4 --upperip 172.16.0.254 --enable
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" dhcpserver remove --netname xm_slc
@mikesmullin
mikesmullin / Que.coffee
Last active January 2, 2016 23:59
Que asynchronous flow control coffeescript micro library
Que = new: ->
Q = []
Q.then = (fn, args...) -> Q.push(-> args.push Q.next; fn.apply null, args); @
Q.next = (err) -> Q.splice 0, Q.length-1 if err; Q.shift()?.apply null, arguments
Q.finally = (fn, args...) -> Q.push(-> fn.apply null, args); Q.next()
Q
# --
Q = Que.new()
@mikesmullin
mikesmullin / watch.sh
Last active April 26, 2023 05:20
watch is a linux bash script to monitor file modification recursively and execute bash commands as changes occur
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#
@mikesmullin
mikesmullin / c.cpp
Last active December 22, 2015 01:59
moar_fun_language_experimentation
#include <GL/glfw.h>
#include <iostream>
#define GLFW_INCLUDE_GLU
using namespace std;
int main()
{
@mikesmullin
mikesmullin / asm-alternative.txt
Last active December 21, 2015 16:18
experimental asm alternative modern syntax
eax = ebx # mov
eax = &ebx # lea
push eax
pop eax
eax++ # inc
eax-- # dec
eax += 1 # add
eax -= ebx # sub
eax = &d * &e # imul
# and so on with idev, and, or xor, not, neg, shl, shr,
@mikesmullin
mikesmullin / 2arg_func.c
Last active June 13, 2016 11:38
C to Linux x86-64 Assembly (ASM) examples
#include <stdio.h>
int example(int a, int b) {
return a + b + 3;
}
int main(void) {
printf("%i\n", example(1, 2));
return 0;
}
@mikesmullin
mikesmullin / x86-assembly-notes.md
Last active April 29, 2024 14:10
Notes on x86-64 Assembly and Machine Code

Mike's x86-64 Assembly (ASM) Notes

Assembling Binary Machine Code

Operating Modes:

These determine the assumed/default size of instruction operands, and restricts which opcodes are available, and how they are used.

Modern operating systems, booted inside Real mode,

#!/bin/bash
#
# /usr/local/bin/git-shove
# example:
# git shove "#6: its easier when working alone--or with another very closely--to do smaller, more frequent commits"
#
git add -A &&
if [ $# -gt 0 ]
then