Skip to content

Instantly share code, notes, and snippets.

View RavuAlHemio's full-sized avatar

Ondřej Hošek RavuAlHemio

View GitHub Profile
@RavuAlHemio
RavuAlHemio / IntHashtable.java
Created December 15, 2013 00:37
Java-Dateien für PK (2013W) Blatt 7 Aufgabe 5
// Hashtabelle ist Beispiel für die Nutzung von Zufall und Wahrscheinlichkeit
// Hashtabelle ganzer Zahlen
// verwendet verkettete Liste zum Umgang mit Kollisionen
public class IntHashtable {
public static final int TABSIZE = 1024; // Größe der Hashtabelle
private IntListNode[] tab = new IntListNode[TABSIZE]; // die eigentliche Hashtabelle
// berechne den Hashwert von elem
@RavuAlHemio
RavuAlHemio / Main.java
Last active December 31, 2015 13:09
Lösung von Tutorium 05-ods-gleichheit, Beispiel 02-compare
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int N = 10;
Wohnung[] wohnungen = new Wohnung[N];
Wohnung klein = new Wohnung(3, 28);
@RavuAlHemio
RavuAlHemio / Haus.java
Created December 16, 2013 18:16
Lösung von Tutorium 05-ods-gleichheit, Beispiel 03-deep
import java.util.Arrays;
public class Haus {
private Wohnung[] wohnungen;
public Haus() {
wohnungen = new Wohnung[0];
}
@RavuAlHemio
RavuAlHemio / Main.java
Created December 16, 2013 18:16
Lösung von Tutorium 05-ods-gleichheit, Beispiel 01-copy
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int N = 10;
Wohnung[] wohnungen = new Wohnung[N];
Wohnung klein = new Wohnung(3, 28);
@RavuAlHemio
RavuAlHemio / clusters.cpp
Created January 7, 2014 19:44
finding the connected components of a graph
#include <QQueue>
#include <QSet>
#include <iostream>
#include <cstdint>
class Pixel
{
@RavuAlHemio
RavuAlHemio / apples.py
Created January 19, 2014 15:24
given a set of wanted apple types, find combinations of apple types that ensure every apple tree is well-pollinated
import logging
__author__ = 'ondra'
logger = logging.getLogger("apples")
class Apple:
def __init__(self, number, name, bloom_time, good_donors=None, other_donors=None,
triploid=False):
"""
@RavuAlHemio
RavuAlHemio / secvault.c
Created January 19, 2014 23:55
secvault kernel module
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/cdev.h>
#include <linux/semaphore.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/thread_info.h>
#include <linux/sched.h>
@RavuAlHemio
RavuAlHemio / runas-stdio.cpp
Created January 27, 2014 09:13
runas-stdio: A variant of runas which takes all its parameters as UTF-8 strings via stdio.
// Released into the public domain.
// http://creativecommons.org/publicdomain/zero/1.0/
#include <string>
#include <cstdio>
#include <fcntl.h>
#include <io.h>
#include <windows.h>
@RavuAlHemio
RavuAlHemio / gdbcheatsheet.md
Created February 2, 2014 12:20
gdb cheat sheet (in German)

Programm starten

Programmargumente können entweder auf der Kommandozeile übergeben werden:

gdb --args ./prog arg1 arg2 arg3

oder als Teil des gdb-Befehls run:

gdb ./prog

@RavuAlHemio
RavuAlHemio / deriff.py
Created May 9, 2014 07:46
dissect a RIFF file and extract all WAVE components into .wav files
import io
import struct
container_chunks = {b"RIFF", b"LIST"}
class RiffChunk:
def __init__(self, tag, data):
self.tag = tag
self.data = data