Skip to content

Instantly share code, notes, and snippets.

codedot / hello.js
Created Apr 30, 2012
Uniweb Server Library
View hello.js
var start = require("uniweb");
//var read = require("fs").readFileSync;
function hello(socket) {
socket.on("message", function(msg) {
socket.send("alert(\"" + msg + "\");");
socket.send("socket.send(\"Hello World!\");");
codedot / hello.js
Created May 1, 2012
Uniweb Server Helper
View hello.js
var start = require("uniwebjs");
//var read = require("fs").readFileSync;
function hello(socket, data) {
if (data) { {
}, data);
} else { {
codedot / client.js
Created May 2, 2012
Uniweb Server Merged
View client.js
var orig = "<!doctype html>";
orig = orig.concat("<meta charset=\"utf-8\">");
orig = orig.concat("<title></title>");
orig = orig.concat("<script>");
orig = orig.concat("var socket = new WebSocket(\"url\");");
orig = orig.concat("socket.onmessage = function (msg) {");
orig = orig.concat("eval(;");
orig = orig.concat("};");
orig = orig.concat("</script>");
codedot / Makefile
Created Nov 14, 2012
Convert text into C strings
View Makefile
all: verbatim.h
verbatim.h: txt2cs.sed def.h sim.c
printf '#define %s \\\n%s\n\n' >$*.tmp \
INDEF "$$(sed -f txt2cs.sed def.h)"
printf '#define %s \\\n%s\n' >>$*.tmp \
INSIM "$$(sed -f txt2cs.sed sim.c)"
mv $*.tmp $@
codedot / Makefile
Created Nov 24, 2012
Tree Exercise
View Makefile
TEST = 0
all: gentree
./gentree $(TEST) >output.c
$(MAKE) output
[ $(TEST) = $$(./output) ]
-rm -f gentree output output.c
codedot / add
Created Dec 23, 2012 — forked from anonymous/add
Scripts for cloning fair-scheduled zones in Solaris 11. To be installed under /opt/custom. Assume `chmod +x /opt/custom/{add,reset}; zonecfg -z origin "create; set zonepath=/zones/origin"; zoneadm -z origin install; zonecfg -z global set cpu-shares=1; dispadm -d FSS; reboot` done before using. Run /opt/custom/reset once, then /opt/custom/add for…
View add
set -Cex
export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/usr/bin:/usr/sbin
codedot / Makefile
Last active Dec 10, 2015
Strictly Conforming XSI Application that counts unique non-empty keys from standard input, and prints those appearing at least MINCNT times.
View Makefile
SCRIPT = "awk -F , -f cut.awk <input.csv | ./count >output.txt"
all: cut.awk count input.csv
time sh -c $(SCRIPT)
-rm -f count output.txt
codedot / Makefile
Created Jan 9, 2013
Shell Word Expansions using wordexp() system interface
View Makefile
all: wordexp
-rm -f wordexp
codedot / Makefile
Last active Dec 16, 2015
Recompile a Bitcoin miner per Getwork
View Makefile
all: nonce
time ./nonce
nonce: nonce.c data.c
gcc -O3 -Wall -Werror nonce.c -o $@
data.c: parse.sed work.js
sed -n -f parse.sed work.js >$@
codedot / Makefile
Last active Dec 18, 2015
Simulation of RAM0 using Verilog
View Makefile
all: ram0
-rm -f ram0
iverilog -Wall -DSIM -o $@ $<