Skip to content

Instantly share code, notes, and snippets.

View blubberdiblub's full-sized avatar
🤯

Niels Boehm blubberdiblub

🤯
View GitHub Profile
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -199,7 +199,7 @@ void b43_leds_init(struct b43_wldev *dev
sprom[2] = bus->sprom.gpio2;
sprom[3] = bus->sprom.gpio3;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 2; i++) {
if (sprom[i] == 0xFF) {
/* There is no LED information in the SPROM
@blubberdiblub
blubberdiblub / myfileio.diff
Created December 20, 2010 16:44
dolphin-emu Issue 1749
Index: Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp
===================================================================
--- Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp (revision 6634)
+++ Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp (working copy)
@@ -25,6 +25,10 @@
#include <algorithm>
#include <fstream>
+#include <sys/types.h>
+#include <sys/stat.h>
@blubberdiblub
blubberdiblub / cryptkey.sh
Created October 29, 2012 16:18
cryptsetup key script that reads the key from a USB stick and failing that prompts the user
#!/bin/sh
DEVICE='/dev/disk/by-label/NIELS'
WAIT=10
MOUNTP='/tmp/cryptkey'
FSTYPE=vfat
FSOPTS='uid=0,gid=0,codepage=850,iocharset=iso8859-1,utf8'
FSPATH='niels'
rc=1
@blubberdiblub
blubberdiblub / filter.py
Created March 26, 2013 09:55
filter diagram
#!/usr/bin/env python
from __future__ import division
import sys
import math
OVERSAMPLING_FACTOR = 1
SAMPLING_FREQUENCY = 48000 * OVERSAMPLING_FACTOR
PASSES = 100000
@blubberdiblub
blubberdiblub / mcdissect.py
Last active August 29, 2015 14:05
minecraft packet dissector
@handler('read', channel=channel_upstream)
def read(self, data):
offset = 0
while True:
shift = 0
size = 0
while True
if offset >= len(data):
#!/usr/bin/env python
import hashlib
def chunked_sha1sum(filelike, chunk_size=0x100000):
hasher = hashlib.new('sha1')
while True:
chunk = filelike.read(chunk_size)
#!/usr/bin/env python
import itertools
lines = ['one', 'two', 'three']
it, it_look_ahead = itertools.tee(lines)
next(it_look_ahead)
for line in it:
@blubberdiblub
blubberdiblub / numpy_needle_in_haystack.py
Created May 21, 2016 14:45
Search a 1d needle in a 1d haystack with numpy
#!/usr/bin/env python
import numpy as np
def np_find_1d(needle, haystack):
needle = np.asanyarray(needle)
haystack = np.ascontiguousarray(haystack)
assert needle.ndim == 1
//Previous code
a = list(map(int, raw_input().split()))
for i in a:
if a.count(i) == 1:
print i
break
// Current code
from collections import Counter
@blubberdiblub
blubberdiblub / test.py
Created January 20, 2017 07:36
Program producing some random output and errors in random intervals.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import random
import sys
import time
for i in range(1000):