Skip to content

Instantly share code, notes, and snippets.

View theonewolf's full-sized avatar

Wolfgang Richter theonewolf

View GitHub Profile
@theonewolf
theonewolf / ext4.h
Created October 17, 2012 02:20
ext4 datastructures
#define SECTOR_SIZE 512
#define EXT4_SUPERBLOCK_OFFSET 1024
struct ext4_superblock
{
uint32_t s_inodes_count;
uint32_t s_blocks_count_lo;
uint32_t s_r_blocks_count_lo;
uint32_t s_free_blocks_count_lo;
uint32_t s_free_inodes_count;
@theonewolf
theonewolf / tcpdump
Created October 16, 2012 17:49
VM IO Slowdown Culprits
13:45:06.096992 IP clamav-du.viaverio.com.http > mueller.43412: Flags [P.], seq 18349422:18350374, ack 143, win 33304, options [nop,nop,TS val 1092767572 ecr 126307304], length 952
13:45:06.097000 IP mueller.43412 > clamav-du.viaverio.com.http: Flags [.], ack 18350374, win 661, options [nop,nop,TS val 126307325 ecr 1092767572], length 0
13:45:06.179816 IP clamav-du.viaverio.com.http > mueller.43412: Flags [.], seq 18350374:18353270, ack 143, win 33304, options [nop,nop,TS val 1092767653 ecr 126307325], length 2896
13:45:06.179863 IP mueller.43412 > clamav-du.viaverio.com.http: Flags [.], ack 18353270, win 651, options [nop,nop,TS val 126307345 ecr 1092767653], length 0
13:45:06.179940 IP clamav-du.viaverio.com.http > mueller.43412: Flags [.], seq 18353270:18354718, ack 143, win 33304, options [nop,nop,TS val 1092767653 ecr 126307325], length 1448
13:45:06.180156 IP clamav-du.viaverio.com.http > mueller.43412: Flags [.], seq 18354718:18356166, ack 143, win 33304, options [nop,nop,TS val 1092767653 ecr 12630732
@theonewolf
theonewolf / sw_install.log
Created October 16, 2012 14:50
sw_install stdout log
wolf@gs9671 /home/wolf/logger/mueller : cat guest_command.stdout.sw_install.2012-10-16.03:11:58.log
Warning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts.
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
linux-headers-3.2.0-23-generic linux-headers-3.2.0-23
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common aspell
@theonewolf
theonewolf / printer.sh
Created October 7, 2012 19:53
print return value of program
#!/bin/bash
function test
{
return 10
}
test
/usr/bin/printf '%d\n' $?
wolf@gs9671 /home/wolf/VM/vm_ext4_test : file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x214a38d0db472db559f0dabf0ae97f82fea83e03, stripped
wolf@gs9671 /home/wolf/VM/vm_ext4_test : readelf /bin/ls -a
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
@theonewolf
theonewolf / static_puzzle.c
Created September 14, 2012 02:36
static keyword C puzzle :-)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int static_puzzle()
{
static int i = 0;
for (; i < 10; i++)
{
return i;
@theonewolf
theonewolf / opencv.diff
Created September 4, 2012 04:18
OpenCV Diff
diff --git a/filters/ocv_face/fil_ocv.c b/filters/ocv_face/fil_ocv.c
index ac31903..1662986 100644
--- a/filters/ocv_face/fil_ocv.c
+++ b/filters/ocv_face/fil_ocv.c
@@ -25,7 +25,9 @@
#include <unistd.h>
#include "lib_ocvimage.h"
-#include <opencv/cvaux.h>
+#include <opencv/cv.h>
@theonewolf
theonewolf / micro_sieve.py
Created August 19, 2012 01:32
Sieve of Erastosthenes
def sieve_of_erastosthenes(till):
primelist = [True]*(till+1)
primelist[0] = primelist[1] = False
nextprime = (i for i,v in enumerate(primelist) if v)
while (True):
try:
prime = nextprime.next()
except StopIteration:
return primelist
@theonewolf
theonewolf / p10.py
Created August 18, 2012 22:32
Project Euler
#!/usr/bin/env python
import sys
def sieve_of_erastothenes(till):
primelist = [True]*(till+1)
primelist[0] = primelist[1] = False
nextprime = (i for i,v in enumerate(primelist) if v)
while (True):