Skip to content

Instantly share code, notes, and snippets.

View cvubrugier's full-sized avatar

Christophe Vu-Brugier cvubrugier

View GitHub Profile
@cvubrugier
cvubrugier / keypress.py
Created April 22, 2015 13:15
Ugly script that intercepts keypress on Linux with Python
#!/usr/bin/python
from __future__ import print_function
import sys
import termios
import tty
def main():
fd = sys.stdin.fileno()
@cvubrugier
cvubrugier / libiscsi-null-ptr-deref.c
Created September 12, 2014 08:32
Snippet from iscsi-test-cu.c that triggers a segfault when built with gcc 4.9
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
static int
add_tests(const char *testname_re)
@cvubrugier
cvubrugier / dlsum
Last active August 29, 2015 13:57
Endlessly download a file with wget and verify that its content is unchanged.
#!/bin/sh
#
# Endlessly download a file with wget and verify that its content is unchanged.
# Usage: dlsum URL
#
error () {
echo "Data corruption detected! Here is the diff:"
mv $filename "${filename}.bad"
hexdump -C "${filename}.good" > "${filename}.good.hex"
@cvubrugier
cvubrugier / simpleparse-pyparsing-cmp.py
Last active December 22, 2015 19:49
The purpose of this script is to ensure that configshell behaves the same way when simpleparse is replaced with pyparsing. Currently, configshell uses simpleparse to parse the commands, but I intend to replace it with pyparsing which is more actively maintained and more widely used.
#!/usr/bin/python
#
# The purpose of this script is to ensure that configshell behaves the
# same way when simpleparse is replaced with pyparsing. Currently,
# configshell uses simpleparse to parse the commands, but I intend to
# replace it with pyparsing which is more actively maintained and more
# widely used.
#
# This script reads the command history of targetcli and verifies that
# the commands are parsed the same way with simpleparse and pyparsing.