Skip to content

Instantly share code, notes, and snippets.

View olsner's full-sized avatar

Simon Brenner olsner

View GitHub Profile
#define _ /*
# C++ Type-Printer Template
#
# Build instructions:
# - Uses C99 variadic macros and C++11 variadic templates, so reasonably
# recent compiler necessary.
#
# Usage:
# 1) As C++ code: Add your own type to the main function, instantiate the
# printer template on that type, call the resulting printer function.
USER foo localhost foo :Don't worry, be happy
NICK foo
JOIN #somestupidchannel
; vim:ts=8:sts=8:sw=8:filetype=nasm:
; This is the real bootstrap of the kernel, and
; it is this part that is loaded by the boot sector (boot.asm)
org 0
bits 16
%macro define_descriptor 6 ; 0-6 0,0,0,0,0,0
dw %1 ;seg_limit
dw %2 ;addr_00_15
@olsner
olsner / hello64.asm
Created June 29, 2012 18:07
hello64
;
; Small, self-contained 64-bit ELF executable for NASM
; compile with nasm -f bin -o hello64.bin
;
; Adapted from: http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
;
; http://blog.markloiseau.com/2012/05/tiny-64-bit-elf-executables/
BITS 64
org 0x00010000 ; Program load offset
@olsner
olsner / zfs-ashift.patch
Created August 8, 2012 19:15
ZFS ashift patch, goes on top of grub2_1.99-12ubuntu5+zfs1~oneiric1
From 969fa64fb48758e1fcc565057dd04bce186cfd77 Mon Sep 17 00:00:00 2001
From: Simon Brenner <olsner@gmail.com>
Date: Thu, 29 Dec 2011 15:14:19 +0100
Subject: [PATCH] zfs ashift patch
https://github.com/pendor/grub-zfs/commit/e7b6ef3ac3b9685ac4c394c897b1d4221b7381f1.diff
Plus whitespace fixes, conflict resolution and a compile fix in
uberblock_verify.
---
@olsner
olsner / convert.sh
Created August 9, 2012 15:19
Extract text from Intel's Software Developer's Manual
#!/bin/bash
pdftotext="$(which pdftotext)"
r() {
#echo "$@"
"$@"
}
pdftotext() {
r "$pdftotext" -nopgbrk -x 0 -y 120 -W 2000 -H 550 "$@"
}
@olsner
olsner / sauce.py
Created September 15, 2012 13:10
Find source files and lines that use up space in ELF binaries
#!/usr/bin/env python
# vim:et:
class Section(object):
def __init__(self, name):
self.name = name
self.start = None
self.end = None
self.size = None
@olsner
olsner / modules.pcimap
Created February 22, 2013 23:18
amr/megaraid pci ids (linux)
# pci module vendor device subvendor subdevice class class_mask driver_data
megaraid_mbox 0x00001028 0x0000000e 0x00001028 0x00000123 0x00000000 0x00000000 0x0
megaraid_mbox 0x00001000 0x00001960 0x00001028 0x00000520 0x00000000 0x00000000 0x0
megaraid_mbox 0x00001000 0x00001960 0x00001028 0x00000518 0x00000000 0x00000000 0x0
megaraid_mbox 0x00001000 0x00000407 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
megaraid_mbox 0x00001028 0x0000000f 0x00001028 0x0000014a 0x00000000 0x00000000 0x0
megaraid_mbox 0x00001028 0x00000013 0x00001028 0x0000016c 0x00000000 0x00000000 0x0
megaraid_mbox 0x00001028 0x00000013 0x00001028 0x0000016d 0x00000000 0x00000000 0x0
megaraid_mbox 0x00001028 0x00000013 0x00001028 0x0000016e 0x00000000 0x00000000 0x0
megaraid_mbox 0x00001028 0x00000013 0x00001028 0x0000016f 0x00000000 0x00000000 0x0
#include <stdio.h>
int main(void) {
int n = sizeof(0)["abcdefghij"];
printf("%d\n", n);
return 0;
}
@olsner
olsner / git-rtag
Created September 4, 2013 13:21 — forked from anonymous/git-rtag
#!/bin/bash
# vim:ts=8:
#####################################################################
# Default scale used by float functions.
float_scale=2
#####################################################################