Skip to content

Instantly share code, notes, and snippets.

Avatar

Sönke J. Peters speters

View GitHub Profile
View keybase.md

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 / xfiles.h
Created Sep 17, 2015
C macro to for binary file inclusion
View xfiles.h
/* 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 Sep 10, 2015
git post-commit hook script to copy a subdirectory of the repo to another folder
View post-commit
#!/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}
@speters
speters / bangrush.sh
Created Nov 30, 2015
Simple web server "load testing" tool
View bangrush.sh
#!/bin/bash
exit
NUM=25
#$1
#DEBUG="true"
PIDLIST=""
MYPID=$$
CURLINST=0
@speters
speters / pramod.ranade.c
Last active Dec 22, 2015 — forked from tmpvar/pramod.ranade.c
See "Linear motion control without the math" by Pramod Ranade in http://www.nxtbook.com/nxtbooks/cmp/esd0409/index.php?startid=23 (Embedded System Design Vol 22, #4, April 2009) and http://picprog.strongedge.net/step_prof/step-profile.html
View pramod.ranade.c
/*
step.c
Program to verify new algorithm for linear acceleration.
Author: Pramod Ranade <pramod.ranade@spjsystems.com>
*/
#include <stdio.h>
#if defined(_WIN32) || defined(_WIN64)
#include <io.h>
#endif
@speters
speters / hd44780sim.serialwombat.c
Last active Dec 23, 2015
jbroadwell tried to simulate an hd44780 lcd in http://www.microchip.com/forums/m227487.aspx This is the indented code posted therein.
View hd44780sim.serialwombat.c
/*
* 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
@speters
speters / ihexcrc.py
Created Sep 25, 2013
ihex crc recalculator Calculates the checksums of lines in an ihex/intel hex file. Useful for patching a hex file.
View ihexcrc.py
#!/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 / Digital_Feed_2e.ino
Last active Dec 28, 2015
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/
View Digital_Feed_2e.ino
#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 / xmasraffle.sh
Created Dec 19, 2013
Proof of concept for a now closed bug
View xmasraffle.sh
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 / screenshot.js
Created Dec 19, 2013
Simple PhantomJS screenshot script
View screenshot.js
#!/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();
}