Skip to content

Instantly share code, notes, and snippets.

View pyropeter's full-sized avatar

PyroPeter pyropeter

View GitHub Profile
#include <stdlib.h>
#include <stdio.h>
#include <getopt.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/syscall.h>
@pyropeter
pyropeter / aurit.sh
Created August 26, 2010 19:41
AUR-tools
#!/usr/bin/env bash
set -e
set -u
# Does like everything you can do with a PKGBUILD:
# * Builds source package
# * TODO: Runs namcap on PKGBUILD
# * Builds binary package
# * Runs namcap on the binary package
@pyropeter
pyropeter / aurupload.sh
Last active September 5, 2015 22:05
AUR upload helper script
#!/bin/bash
set -u
set -e
declare -A categorys
categorys[daemons]=2
categorys[devel]=3
categorys[editors]=4
categorys[emulators]=5
@pyropeter
pyropeter / base64.c
Created September 2, 2010 19:28
base64 de/encode in C
static const char b64[] = "\
ABCDEFGHIJKLMNOPQRSTUVWXYZ\
abcdefghijklmnopqrstuvwxyz\
0123456789+/";
static const unsigned char b64dec[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x00
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0x10
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, //0x20
@pyropeter
pyropeter / compare.py
Created September 26, 2010 14:50
AUR: that language stuff
#! /usr/bin/python -O
# -*- coding: utf-8 -*-
from findkeys import findkeys
from parsepo import parseall
def dings():
used = findkeys()
translations, langs = parseall()
@pyropeter
pyropeter / LICENSE
Last active December 2, 2016 12:25
python module de/encoding bencoded data
Copyright (c) 2015, PyroPeter <$nickname@$nickname.eu>
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@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:
@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 / 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 / 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];