Skip to content

Instantly share code, notes, and snippets.

@justincormack
justincormack / gist:9031981
Created February 16, 2014 10:03
emerge --update --deep --with-bdeps=y @world
mips64-unknown-linux-gnu-g++ -c -DEFAULT_SSP -DIN_GCC_FRONTEND -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables
-W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-over
length-strings -DHAVE_CONFIG_H -I. -Ic -I/var/tmp/portage/sys-devel/gcc-4.8.2/work/gcc-4.8.2/gcc -I/var/tmp/portage/sys-devel/gcc-4.
8.2/work/gcc-4.8.2/gcc/c -I/var/tmp/portage/sys-devel/gcc-4.8.2/work/gcc-4.8.2/gcc/../include -I/var/tmp/portage/sys-devel/gcc-4.8.2/w
ork/gcc-4.8.2/gcc/../libcpp/include -I/var/tmp/portage/sys-devel/gcc-4.8.2/work/gcc-4.8.2/gcc/../libdecnumber -I/var/tmp/portage/sys-devel/gcc-4.8.2/work/gcc-4.8.2/gcc/../libdecnumber/dpd -I../libdecnumber -I/var/tmp/portage/sys-devel/gcc-4.8.2/work/gcc-4.8.2/gcc/../libbacktrace /var/tmp/portage/sys-devel/gcc-4.8.2/work/gcc-4.8.2/gcc/c/c-lang.c -o c/c-lang.o
Makefile:3605: recipe for target 's-attrtab' failed
make[3]: *** [s-attrtab] Killed
make[3]: *** Waiting for unfinished
@justincormack
justincormack / gist:6556530
Created September 13, 2013 21:49
ljsyscall passing all tests under xen!
Parsing config from domain_config
DEBUG libxl__blktap_devpath 37 aio:/home/justin/minios/32/test.ffs
DEBUG libxl__blktap_devpath 40 /dev/xen/blktap-2/tapdev4
Daemon running with PID 12219
start_info: 0x326000(VA)
nr_pages: 0x4000
shared_inf: 0xd8af1000(MA)
pt_base: 0x329000(VA)
nr_pt_frames: 0x5
mfn_list: 0x316000(VA)
@justincormack
justincormack / gist:6526826
Created September 11, 2013 17:19
First run of the ljsyscall test suite on Xen
sudo xl create -c domain_config
Parsing config from domain_config
DEBUG libxl__blktap_devpath 37 aio:/home/justin/minios/32/test.ffs
DEBUG libxl__blktap_devpath 40 /dev/xen/blktap-2/tapdev4
Daemon running with PID 1968
start_info: 0x2f4000(VA)
nr_pages: 0x2000
shared_inf: 0xc775e000(MA)
pt_base: 0x2f7000(VA)
nr_pt_frames: 0x5
@justincormack
justincormack / pts.c
Created July 14, 2013 09:07
rump kernel ioctl issue
#include <dlfcn.h>
#include <stdio.h>
#include <sys/types.h>
#include <inttypes.h>
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
#include <rump/netconfig.h>
typedef uint32_t _netbsd_mode_t;
@justincormack
justincormack / bounds
Created July 5, 2013 13:33
ffi array bounds checking 2
ffi = require "ffi"
local VHOST_VRING_SIZE = 32*1024
ffi.cdef [[
enum { VHOST_VRING_SIZE = 32*1024 };
struct vring_avail {
uint16_t flags;
uint16_t idx;
@justincormack
justincormack / gist:5934351
Created July 5, 2013 12:53
metatypes for bounds checking
ffi = require "ffi"
local VHOST_VRING_SIZE = 32*1024
ffi.cdef [[
enum { VHOST_VRING_SIZE = 32*1024 };
struct vring_avail {
uint16_t flags;
uint16_t idx;
@justincormack
justincormack / sigint backtrace
Created April 17, 2013 22:37
How to get SIGINT to give a backtrace using ljsyscall
local S = require "syscall"
local t = S.t
local c = S.c
local ffi = require "ffi"
local ip
if ffi.arch == "x86" then ip = c.REG.EIP
elseif ffi.arch == "x64" then ip = c.REG.RIP
else error "unsupported architecture" end
@justincormack
justincormack / tmp.lua
Created August 4, 2012 17:46
test case for segfault
local ffi = require "ffi"
local bit = require "bit"
local C = ffi.C
local S = {}
local t = {}
local s = {}
@justincormack
justincormack / index.html
Created March 2, 2012 14:46
Colour tests
<html>
<head>
<title>Testing colours</title>
</head>
<body>
<script src="https://raw.github.com/justincormack/d3/master/d3.v2.min.js"></script>
<p>Brighter and darker, RGB vs HSL vs CIELab</p>
<svg id="rgb-bright1"></svg>
@justincormack
justincormack / perf.lua
Created July 11, 2011 23:24
ljsyscall perf test
local S = require "syscall"
local t = S.t
local oldassert = assert
function assert(c, s)
return oldassert(c, tostring(s)) -- annoyingly, assert does not call tostring!
end
local s = assert(S.socket("inet", "stream, nonblock"))