This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path'); | |
| function trace(s) { | |
| const orig = Error.prepareStackTrace; | |
| Error.prepareStackTrace = (_, stack) => stack; | |
| const err = new Error(); | |
| Error.captureStackTrace(err, arguments.callee); | |
| Error.prepareStackTrace = orig; | |
| const callee = err.stack[0]; | |
| process.stdout.write(`${path.relative(process.cwd(), callee.getFileName())}:${callee.getLineNumber()}: ${s}\n`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Reverse Polish Notation Calculator (in CoffeeScript) | |
| # authored by Mike Smullin <mike@smullindesign.com> | |
| # | |
| # see also: | |
| # https://en.wikipedia.org/wiki/Polish_notation | |
| # http://www.calculator.org/rpn.aspx | |
| # http://blog.reverberate.org/2013/07/ll-and-lr-parsing-demystified.html | |
| # http://stackoverflow.com/questions/5975741/what-is-the-difference-between-ll-and-lr-parsing | |
| # https://www.amazon.com/Definitive-ANTLR-4-Reference/dp/1934356999 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Process Loop | |
| # Author: Mike Smullin <mike@smullindesign.com> | |
| # License: MIT | |
| # Usage: | |
| # | |
| # ./loop node --debug app.js | |
| # | |
| # Ctrl+C Restarts | |
| # Ctrl+\ Quits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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...> | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <GL/glfw.h> | |
| #include <iostream> | |
| #define GLFW_INCLUDE_GLU | |
| using namespace std; | |
| int main() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, |