Skip to content

Instantly share code, notes, and snippets.

View cwacek's full-sized avatar

Chris W cwacek

  • Project Blink
  • Washington DC
View GitHub Profile
@cwacek
cwacek / stack trace
Created October 30, 2013 17:34
Debugging Shadow (scallion) segfaults in encryption functions
#0 0x00007ffff1e51368 in EVP_EncryptUpdate () from /home/users/cwacek/.shadow/lib/libcrypto.so.1.0.0
#1 0x00007ffff299edf3 in aes_crypt_inplace () at /home/cwacek/projects/shadow/build/tor/src/common/aes.c:130
#2 0x00007ffff2989ad6 in crypto_cipher_crypt_inplace () at /home/cwacek/projects/shadow/build/tor/src/common/crypto.c:1335
#3 0x00007ffff28fea3d in relay_crypt_one_payload () at /home/cwacek/projects/shadow/build/tor/src/or/relay.c:144
#4 0x00007ffff28ff8d6 in circuit_package_relay_cell () at /home/cwacek/projects/shadow/build/tor/src/or/relay.c:398
#5 0x00007ffff28ff376 in relay_send_command_from_edge () at /home/cwacek/projects/shadow/build/tor/src/or/relay.c:613
#6 0x00007ffff2861758 in command_process_created_cell () at /home/cwacek/projects/shadow/build/tor/src/or/command.c:543
#7 0x00007ffff2860c3b in command_process_cell () at /home/cwacek/projects/shadow/build/tor/src/or/command.c:212
#8 0x00007ffff291b0b0 in connection_or_process_cells_from_inbuf () at /home/cwacek/projects/shadow/buil
@cwacek
cwacek / timeout.sh
Last active January 11, 2020 22:53
Run a command with a timeout. This is useful for things like 'df' which can hang if NFS is misbehaving
#!/bin/bash
timeout=$1
shift
cmd=$1
shift
args=$@
if [[ -z "$cmd" ]]; then
echo "timeout.sh <seconds> <cmd>"
@cwacek
cwacek / gist:6613735
Last active December 23, 2015 09:19
Decode SAFEST Coordinate
c = "0302A3DC4081535367C002B9D21D0E7379408F39625AD67A70400000000000000000D43E85729743E63F"
import struct
decoded = c.decode('hex')
dim, vartype = struct.unpack('=bb', decoded[:2])
fmt = 'f' if vartype == 1 else 'd'
fmtsz = 4 if fmt == 'f' else 8
@cwacek
cwacek / cobbler-uefi-pxe-rhel.md
Last active January 17, 2022 21:26
A description of how to make Cobbler, PXE, and UEFI behave for Red Hat Enterprise Linux 6 installations

UEFI PXE Installation of RHEL6.4

For some reason, starting a PXE boot installation of RHEL6.4 on UEFI systems is poorly documented. Simultaneously, the process is not terribly verbose when it fails. Here's what I had to do to get this to work.

We going to use Cobbler to take care of a lot of the gruntwork (TFTP, DHCP, etc). It's entirely possible to do it without Cobbler, but even accounting for its warts it will make you more

@cwacek
cwacek / .screenrc
Created June 6, 2013 20:58
Screen RC example
# Turn off that annoying start up message
startup_message off
# Turn the even more annoying whole-screen-flash-on-tab-complete "feature"
vbell off
terminfo xterm-color hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
term xterm-color
# Window list at the bottom. hostname, centered tabs and redmarked active windows:
@cwacek
cwacek / ptrmap.c
Last active December 17, 2015 12:49
An example of how to use uthash for generalized pointer storage with a string key.
typedef struct {
uint32_t intkey;
char strkey[64];
void * data;
UT_hash_handle hh;
} ptrmap_t;
#define str_ptrmap_insert(map,key,insval) \
do { \
@cwacek
cwacek / dbus_skype_ex1.py
Created September 5, 2012 17:42
Skype DBus example
# http://forum.skype.com/index.php?showtopic=480701
import time
import gobject
import dbus, sys
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
from threading import Thread