Skip to content

Instantly share code, notes, and snippets.

View pyropeter's full-sized avatar

PyroPeter pyropeter

View GitHub Profile
@pyropeter
pyropeter / sync
Created January 10, 2014 22:15
Ugly shell script to do a bidirectional sync of two git repos (Like monotones sync command)
#!/bin/bash
set -e
set -u
# this script assumes the following:
# * you want to sync the master[0-9]+ branches
# * you are in a non-bare repo
# * this script runs interactive (maybe not needed?)
# * the remote to sync with is 'origin' and a bare repo
@pyropeter
pyropeter / stupidStuff.java
Created February 15, 2013 14:43
Just some strange stuff that apparently works in Java.
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;
public class Modul1
{
/**
* Diese Methode erhaelt zwei Integer-Iterator-Listen und muss eine
* weitere Integer-Iterator-Liste zurueckgeben. Die beiden Eingaben
* haben beliebige "Formen", allerdings kann man sich darauf verlassen,
@pyropeter
pyropeter / handler.sh
Last active October 13, 2015 01:57
Embassy of Nerdistan Tuerstatuserkennung
#!/bin/sh
LED='/sys/class/leds/tp-link:green:qss/brightness'
if [ "$BUTTON" != reset ]; then
exit
fi
if [ "$ACTION" = pressed ]; then
echo 0 > /tmp/tuer_offen
@pyropeter
pyropeter / qrdetect.py
Created August 19, 2012 20:53
My try at QR code detection (unfinished & broken)
import math
import numpy
import cv2
def isPattern(one, two, three, four, five):
if not one:
return
size = float(one + two + three + four + five) / 7
@pyropeter
pyropeter / arte-plus-7.sh
Created March 25, 2011 16:00
Downloads videos from Arte+7
#!/bin/bash
set -e
set -u
if [ $# -lt 1 ]; then
echo "Usage: $0 <videoWebpageUrl>"
exit 1
fi
#0 0x00007fc9b86cf655 in raise () from /lib/libc.so.6
#1 0x00007fc9b86d0ad6 in abort () from /lib/libc.so.6
#2 0x00007fc9b96f5131 in g_assertion_message () from /usr/lib/libglib-2.0.so.0
#3 0x00007fc9b96f56d0 in g_assertion_message_expr ()
from /usr/lib/libglib-2.0.so.0
#4 0x000000000048f22c in signal_unref_full (rec=0x10ce060, remove=1)
at signals.c:64
#5 0x000000000048f4c5 in signal_emit_real (rec=0x10ce060,
params=<value optimized out>, va=<value optimized out>,
first_hook=<value optimized out>) at signals.c:287
@pyropeter
pyropeter / insertion-sort.c
Created November 28, 2010 23:24
Forbidden implementation of an insertion sort
float sorted[histLength];
sorted[0] = history[0];
for (int i = 1 ; i < histLength ; i++) {
for (int j = 0 ; j < i ; j++) {
if (history[i] < sorted[j]) {
for (int k = i - 1 ; k >= j ; k--)
sorted[k+1] = sorted[k];
sorted[j] = history[i];
@pyropeter
pyropeter / cbcWithoutCypher.py
Created November 22, 2010 22:20
Looks like real cryptography!
import random
def encrypt(text):
lastchar = random.randint(0,255)
result = chr(lastchar)
for char in text:
lastchar ^= ord(char)
result += chr(lastchar)
return result
@pyropeter
pyropeter / sndtest.c
Created November 21, 2010 21:43
My "Hello, OSS!" application
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <stropts.h>
#include <string.h>
#include <linux/soundcard.h>
//#include <soundcard.h>
@pyropeter
pyropeter / jeopardy.pde.c
Created November 10, 2010 20:10
Jeopardy theme for arduino
/*
as you can see, this is just an adaption of the toneMelody demo.
*/
/*
Melody
Plays a melody
circuit: