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 / IterativeFloodfillOperation.java
Created January 25, 2011 14:06
iterativer Ansatz für die Floodfill-Operation
import java.util.*;
/**
* Ein iterativer Ansatz für die Floodfill-Operation, weil Rekursion
* gern mal zu Stack-Overflows führt.
*
* Danke an die LVA-Leitung von AlgoDat1, die mir diesen "Trick" beibrachte.
*
* Für jeden Punkt, der aus der Queue entnommen wird, werden der Queue vier
* weitere Punkte hinzugefügt – es sei denn, der entnommene Punkt
@RavuAlHemio
RavuAlHemio / gist:816557
Created February 8, 2011 15:13
GDB backtrace of GWorkspace initialization
(pay no mind to the variable values, please; my debugging information is borked)
#0 0x00007ffff5c15683 in poll () from /lib/libc.so.6
#1 0x00007ffff677c8fe in -[GSRunLoopCtxt pollUntil:within:] (self=<value optimized out>, _cmd=<value optimized out>, milliseconds=<value optimized out>,
contexts=<value optimized out>) at GSRunLoopCtxt.m:424
#2 0x00007ffff66d3fc4 in -[NSRunLoop acceptInputForMode:beforeDate:] (self=<value optimized out>, _cmd=<value optimized out>, mode=<value optimized out>,
limit_date=<value optimized out>) at NSRunLoop.m:1198
#3 0x00007ffff66d4328 in -[NSRunLoop runMode:beforeDate:] (self=<value optimized out>, _cmd=Unhandled dwarf expression opcode 0x0
) at NSRunLoop.m:1266
#4 0x00007ffff6634d9d in -[NSConnection(Private) _getReplyRmc:] (self=0x11801f0, _cmd=0x7ffff6b02b30, sn=0) at NSConnection.m:3186
@RavuAlHemio
RavuAlHemio / ButtPlet.java
Created June 24, 2011 21:28
"Soften image" Java applet
/*
* ButtPlet.java
*
* Created on Jun 24, 2011, 10:46:14 PM
*/
package foon;
import java.applet.Applet;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
@RavuAlHemio
RavuAlHemio / GrowingArray.java
Created September 26, 2011 02:53
Dynamically growing array in Java
public class GrowingArray
{
Object[] array;
int count;
int capacity;
public void appending(Object obj)
{
// grow array if needed
if (count == capacity)
@RavuAlHemio
RavuAlHemio / dsort.c
Created December 11, 2011 13:16
DSort
/**
* @file dsort.c
*
* @author Ondřej Hošek (0925631)
*
* @brief DSort
* @details Concatenates the output of two programs, sorts it, and outputs
* duplicate lines.
*
* @date 2011-04-12
@RavuAlHemio
RavuAlHemio / SkylineSolver.lhs
Created January 20, 2012 23:14
Skyline Solver
This is a Literate Haskell file to make it that much easier to store my thoughts
concisely. I didn't know it would have such an effect on me, but at this stage,
I can only thank the language designers for it.
Skyline fields look a bit like this:
\begin{verbatim}
-1 5 4 3 2 1 -1
5 10 20 30 40 50 1
4 20 30 40 50 10 2
@RavuAlHemio
RavuAlHemio / parser.y
Created April 1, 2012 14:32
scanner/parser, Ox edition
/* vim: set ft=yacc: */
/*
@i isn't very implicit if I have to plaster
all of my code with it...
*/
%start ProgramOrEmpty
%token TOK_SYM_SEMI
@RavuAlHemio
RavuAlHemio / parser.y
Created April 1, 2012 14:35
scanner/parser, Lex/Yacc edition
/* vim: set ft=yacc: */
%start ProgramOrEmpty
%token TOK_SYM_SEMI
%token TOK_SYM_PARBEG
%token TOK_SYM_PAREND
%token TOK_SYM_COMMA
%token TOK_SYM_EQUALS
%token TOK_SYM_TILDE
/**
* @file mysed.c
*
* @brief An oversimplified implementation of sed.
*
* @author Ondřej Hošek <ondrej.hosek@tuwien.ac.at>
*/
#include <assert.h>
#include <errno.h>
@RavuAlHemio
RavuAlHemio / build.ninja
Created October 14, 2012 17:02
flex/bison example buildable with MSVC
cl = C:\Development\VS\VC\bin\cl.exe
flex = C:\Development\MinGW\msys\1.0\bin\flex.exe
bison = C:\Development\MinGW\msys\1.0\bin\bison.exe
cflags = /nologo /DYY_NO_UNISTD_H
lflags = /nologo
rule cc
description = CC $out
command = $cl $cflags /c /Fo$out $in