Skip to content

Instantly share code, notes, and snippets.

View speters's full-sized avatar

Sönke J. Peters speters

View GitHub Profile
@speters
speters / bangrush.sh
Created November 30, 2015 20:25
Simple web server "load testing" tool
#!/bin/bash
exit
NUM=25
#$1
#DEBUG="true"
PIDLIST=""
MYPID=$$
CURLINST=0
@speters
speters / xfiles.h
Created September 17, 2015 13:16
C macro to for binary file inclusion
/* Copyright (c) 2008 Carlos Lamas
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
@speters
speters / post-commit
Created September 10, 2015 18:44
git post-commit hook script to copy a subdirectory of the repo to another folder
#!/bin/sh
# copy a subdirectory of a repository to another location after commit
DESTINATIONDIR=/usr/share/arduino/libraries
# subdirectory in repo to copy:
CHECKOUTSUBDIR=TMRpcm
mkdir /tmp/bla
unset GIT_INDEX_FILE
GIT_WORK_TREE=${DESTINATIONDIR} git checkout -f -- ${CHECKOUTSUBDIR}

Keybase proof

I hereby claim:

  • I am speters on github.
  • I am soenke (https://keybase.io/soenke) on keybase.
  • I have a public key whose fingerprint is D33D 153A A5D3 937E 8D99 907F EFC4 178C F358 FDCA

To claim this, I am signing this object:

@speters
speters / mailcatch.py
Last active March 14, 2016 16:05
A simple utility to forward mailcatch.com temporary mailboxes via SMTP
#! /usr/bin/env python
import urllib2
from xml.dom import minidom, Node
from sys import argv
import smtplib
import ConfigParser, os
config = ConfigParser.SafeConfigParser({'smtphost': 'localhost', 'smtpuser':'', 'smtppass':'', 'forwardto':''})
config.read(['/etc/smtpclient.ini', os.path.expanduser('~/.smtpclient.ini')])
@speters
speters / screenshot.js
Created December 19, 2013 13:24
Simple PhantomJS screenshot script
#!/usr/local/bin/phantomjs
var page = require('webpage').create();
var system = require('system');
var t, address;
if (system.args.length === 1) {
console.log('Usage: screenshot.js <some URL>');
phantom.exit();
}
@speters
speters / xmasraffle.sh
Created December 19, 2013 11:17
Proof of concept for a now closed bug
ENTRYURL='http://go.stayfriends.de/***/xmasRaffle'
COOKIEFILE='cookies.txt'
USER_AGENT="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0"
wget -U "${USER_AGENT}" --spider -S --keep-session-cookies --save-cookies=$COOKIEFILE $ENTRYURL
COOKIEHEADER=`awk -v ORS='' 'BEGIN {print "Cookie: "} /stayfriends/{print $6"="$7"; " } ' < $COOKIEFILE `
# local test against nc -l 8080
@speters
speters / Digital_Feed_2e.ino
Last active December 28, 2015 20:59
Elektronische Leitspindel für eine Drehmaschine mit dem Arduino Mega2560.Version 1a von http://www.chipmaker.ru/files/file/9787/ Urspungsthema in http://www.chipmaker.ru/topic/97701/
#include <avr/pgmspace.h>
// ***** LCD *****
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
char LCD_Row_1[17];
char LCD_Row_2[17];
@speters
speters / ihexcrc.py
Created September 25, 2013 17:56
ihex crc recalculator Calculates the checksums of lines in an ihex/intel hex file. Useful for patching a hex file.
#!/usr/bin/env python
#
# Intel HEX file CRC recalculator
# ihexcrc.py FILEWITHDAMAGEDCRC.HEX > NEWFILE.HEX
#
# See http://goodfet.sourceforge.net/dist/intelhex.py
# for a more elaborate version
#
from array import array
from binascii import hexlify, unhexlify
@speters
speters / hd44780sim.serialwombat.c
Last active December 23, 2015 05:09
jbroadwell tried to simulate an hd44780 lcd in http://www.microchip.com/forums/m227487.aspx This is the indented code posted therein.
/*
* hd44780 simulator
* from
* http://www.microchip.com/forums/m227487-print.aspx
* 2/2007 by jbroadwell
*/
#define FIRST_NIBBLE 0
#define SECOND_NIBBLE 1
#define DDRAM_SIZE 128
typedef struct hd44780_n