Skip to content

Instantly share code, notes, and snippets.

View puddingpimp's full-sized avatar

Dave Cameron puddingpimp

  • True Integration Ltd.
  • New Zealand
View GitHub Profile
@puddingpimp
puddingpimp / kpanic
Created May 19, 2016 11:41
Kernel panic with 8TB SMR drive
(kgdb) bt
#0 doadump (textdump=<value optimized out>) at pcpu.h:219
#1 0xffffffff80959ce2 in kern_reboot (howto=260) at /usr/git/freebsd-10.3/sys/kern/kern_shutdown.c:486
#2 0xffffffff8095a0c5 in vpanic (fmt=<value optimized out>, ap=<value optimized out>) at /usr/git/freebsd-10.3/sys/kern/kern_shutdown.c:889
#3 0xffffffff80959f53 in panic (fmt=0x0) at /usr/git/freebsd-10.3/sys/kern/kern_shutdown.c:818
#4 0xffffffff80df97eb in trap_fatal (frame=<value optimized out>, eva=<value optimized out>) at /usr/git/freebsd-10.3/sys/amd64/amd64/trap.c:858
#5 0xffffffff80df9aed in trap_pfault (frame=0xfffffe044f7d1fe0, usermode=<value optimized out>) at /usr/git/freebsd-10.3/sys/amd64/amd64/trap.c:681
#6 0xffffffff80df916a in trap (frame=0xfffffe044f7d1fe0) at /usr/git/freebsd-10.3/sys/amd64/amd64/trap.c:447
#7 0xffffffff80ddf142 in calltrap () at /usr/git/freebsd-10.3/sys/amd64/amd64/exception.S:236
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <err.h>
int main(int argc, char **argv)
{
int i,limit;
@puddingpimp
puddingpimp / viwal.c
Last active August 29, 2015 14:02
rendomly trenspise vawals en tuxt by Devo Cemerun en 2014
// rendomly trenspise vawals en tuxt by Devo Cemerun en 2014
#include <stdio.h>
#include <stdint.h>
#define uc(a) (a & 0x5f)
#define lc(a) (a | 0x20)
char
rendamviwal(void)
@puddingpimp
puddingpimp / multiboot.fasm
Created May 7, 2014 11:00
Multiboot minimalist OS
use32
UMB_START = 0x00100000
org UMB_START
MB_MAGIC = 1BADB002h
MB_F_BOOTALIGNED = 1
MB_F_MEMINFO = (1 shl 1)
MB_F_VIDEOTABLE = (1 shl 2)
MB_F_USE_MBOFFSETS = (1 shl 16)
MB_FLAGS = MB_F_BOOTALIGNED or MB_F_MEMINFO or \
@puddingpimp
puddingpimp / at.c
Last active December 19, 2015 03:59
at timer - remove unused variable
// at - by Dave Cameron 2013
// A simple timer to run a job at a specific time (in the near future)
// compile like: gcc -Os at.c -o at -lrt
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <err.h>
#include <unistd.h>
@puddingpimp
puddingpimp / mupdf-fixscrolling.patch
Created May 25, 2013 14:19
Fix scrolling in mupdf and use back/forward buttons for page turns
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 887d823..37eed92 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -1402,7 +1402,8 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
int newy = app->pany + y - app->sely;
/* Scrolling beyond limits implies flipping pages */
/* Are we requested to scroll beyond limits? */
- if (newy + fz_pixmap_height(app->ctx, app->image) < app->winh || newy > 0)
+ /* if (newy + fz_pixmap_height(app->ctx, app->image) < app->winh || newy > 0) */
@puddingpimp
puddingpimp / bin2elf
Created May 12, 2013 10:09
Convert binary files to elf symbols
#!/bin/sh
usage() {
echo "usage: $0 <infile> <outelf> [symname]"
echo "Converts binary or text file <outelf> into elf object <outelf> with constant named"
echo "symname defaults to infile if none is specified, with disallowed characters replaced with _"
echo "symname an array containing the <infile>"
echo "symname_length length of array <symname>"
echo "symname_end points to the null byte appended after <symname>"
}