Skip to content

Instantly share code, notes, and snippets.

@cmetz
cmetz / nebula_usb.py
Created December 14, 2020 11:02
Python Durgod K320 Nebula Hacks
import usb.core
import usb.util
import array
import time
import random
import math
import webcolors
import random
from collections import OrderedDict, namedtuple
from sys import exit
@eschulte
eschulte / asm-diff
Created March 26, 2019 20:10
Use objdump to view the differences between two object files
#!/bin/bash
#
# Usage: asm-diff [options] file1 file2 [-- diff options]
# Return the difference in the objudmp parsing of files
#
# OPTIONS:
# -o,--objdump CMD --- specify objdump command to use
# -j,--section NAME -- section to compare
# (default: .text)
# -c,--clean --------- specify whether to clean addresses
@baruch
baruch / gist:106a3da12187b284830e
Created July 20, 2014 06:12
Optimal tar compression
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;
@baruch
baruch / scsi_sense.stp
Created May 15, 2014 19:08
Get full SCSI Sense out of any command failure
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");
@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@baruch
baruch / libev_async_dns.c
Created May 5, 2013 19:02
Asynchronous dns resolving with libev and the gethostbyname_r function.
#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];