Skip to content

Instantly share code, notes, and snippets.

View oerpli's full-sized avatar
🐱
:octocat:

Abraham Hinteregger oerpli

🐱
:octocat:
View GitHub Profile
@oerpli
oerpli / HideEmptyModules.user.js
Last active October 25, 2017 16:37
Userscript that removes empty modules from the record of examinations ("Prüfungspass") on uspace.univie. To toggle empty modules expand your curriculum and then press the button on the top. Installation: Get greasemonkey (FF)or tampermonkey (Chrome), then click on the raw button here and confirm. IE/Edge/Safari users are sol.
// ==UserScript==
// @name ModuleHider
// @namespace hem
// @description hides empty modules in the uspace overview
// @match https://uspace.univie.ac.at/web/studierende/pruefungspass*
// @include https://uspace.univie.ac.at/de/web/studierende/pruefungspass*
// @include https://uspace.univie.ac.at/en/web/studierende/pruefungspass*
// @author oerpli
// @version 1.2
// @grant none
@oerpli
oerpli / LEC.clp
Last active August 29, 2015 14:20
LEC Clips
(deftemplate person
(slot name)
(slot age)
(slot cantpay
(allowed-symbols yes no)
(default yes))
(slot job
(default unemployed)))
(deftemplate parent
@oerpli
oerpli / Encoding.cs
Created January 19, 2015 21:37
Arithmetic Encoding
using System;
using System.Collections.Generic;
using System.Linq;
namespace Encoding {
class Program {
static double sum;
static Dictionary<char, double> Val, Low, High;
static string Input;
ec _ [] = []
ec bla ((a,b):r) = (bla*a+b):ec bla r
e base y = (ec base) . pair $ (map (\x -> toInteger $ (ord x) - (ord 'a') +1) y)
dc _ [] = []
dc bla (a:r) = [div a bla, mod a bla] ++ dc bla r
d base y = map (\x -> " abcdefghijklmnopqrstuvwxyz" !! (length [1..x])) (dc base y) --- length [1..x] is an ugly (::Integer -> Int) hack
pair [] = []
pair (a:b:r) = (a,b) : pair r
@oerpli
oerpli / Privacy Policy VLVZ Application
Created October 9, 2014 23:43
Privacy Policy VLVZ Application
No personal information will be collected or used.
@oerpli
oerpli / FillUp.cs
Last active August 29, 2015 14:05
Interpret arbitrary int array as column diagram - pour water over it and output the amount of water that stays on the array. Best Case O(n), Worst Case O(n²), Average Case O(n)
fillUp(int[] x){
int total = 0;
for(int i = 0;i < x.length-1;i++){
if(x[i] >= x[i+1]){
continue; //if neighbor is higher or equal go to next column
} else {
int j = 2; //neighbor is known to be lower, so we can start at i+2
bool pool = false;
while(i + j < x.length){
if(x[i+j] >= x[i]){ //as soon as a column is at least as big as the reference column
private int kinmc(int endtime, double eps) {
double m = 10;
double c = 0.01;
double time = 0;
int state = 0, nstate = 0;
double r01 = c * m;
double r02 = c;
double r1 = Math.Exp(-eps / 2);
double r2 = Math.Exp(-eps);
@oerpli
oerpli / svclient synchro
Created June 1, 2014 21:39
für rebeccaqt
client:
START:
get semaphors
P(cl_bl)
P(sv_ready)
new game // game with id# plx
V(sv_req)
P(sv_ready)
empfangen
@oerpli
oerpli / DLL Quicksort
Last active August 29, 2015 14:01
A (considering it's java) compact quicksort implementation for a double linked list.
private void sort(ListElement l, ListElement r, DoublyLinkedList in) {
ListElement LastMoved = r;
ListElement FirstNotMoved = null;
while (l != r) {
ListElement next = l.next;
if (l.getKey() > r.getKey()) {
move(l, LastMoved, in);
LastMoved = l;
} else if (FirstNotMoved == null)
FirstNotMoved = l;
using System;
using System.Collections.Generic;
using System.Linq;
namespace flood {
class MainClass {
public static void Main(string[] args) {
while(true) {
Console.Clear();