This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DEFER_MERGE(a,b) a##b | |
#define DEFER_VARNAME(a) DEFER_MERGE(defer_scopevar_, a) | |
#define DEFER_FUNCNAME(a) DEFER_MERGE(defer_scopefunc_, a) | |
#define DEFER(BLOCK) void DEFER_FUNCNAME(__LINE__)(int *a) BLOCK; __attribute__((cleanup(DEFER_FUNCNAME(__LINE__)))) int DEFER_VARNAME(__LINE__) | |
// Usage: | |
/* | |
void dosomething() | |
{ | |
char* data = malloc(100); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
probe module("scsi_mod").function("scsi_command_normalize_sense") { | |
printf("CDB:"); | |
for (i = 0; i < $cmd->cmd_len; i++) { | |
printf(" %02X", $cmd->cmnd[i]); | |
} | |
printf(" | SENSE:"); | |
for (i = 0; i < 32; i++) { | |
printf(" %02X", $cmd->sense_buffer[i]); | |
} | |
printf("\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install sdcc to build nRF24LE1 code | |
# Install python-dev and python-setuptools to build python code for hacking | |
# Install minicom for UART communication | |
# Install screen to avoid network disconnect interruptions | |
sudo apt-get update && sudo apt-get install sdcc python-dev python-setuptools minicom screen | |
sudo apt-get dist-upgrade | |
# Install bcm2835 library | |
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.38.tar.gz && tar xvf bcm2835/bcm2835-1.38.tar.gz && cd bcm2835-1.38 && ./configure && make && sudo make install | |
cd ~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find $d -type f | rev | sort | rev | tar -c -T /dev/stdin -f - | pv -pterb -B 10m -s $(du -ms $d | cut -f1)m -W -i 10 | bzip2 -6 > $d.tar.bz2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
probe module("scsi_mod").function("scsi_command_normalize_sense") { | |
printf("CDB:"); | |
for (i = 0; i < $cmd->cmd_len; i++) { | |
printf(" %02X", $cmd->cmnd[i]); | |
} | |
printf(" | SENSE:"); | |
for (i = 0; i < 32; i++) { | |
printf(" %02X", $cmd->sense_buffer[i]); | |
} | |
printf("\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r.db('mydb').table('disk').withFields('glist').groupedMapReduce( | |
function(x) { return x }, | |
function(x) { return 1 }, | |
function(x,y) { return 1 } | |
) | |
.map(function (x) { return x('group')('glist') }) | |
.reduce(function(x,y) { return | |
{ | |
count: x('count').add(1), | |
val: x('val').union([y]).sample(10), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ev.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <netdb.h> | |
#include <memory.h> | |
typedef struct net_client_t { | |
ev_signal resolv_watcher; | |
char hostname[64]; |