Skip to content

Instantly share code, notes, and snippets.

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

Abraham Hinteregger oerpli

🐱
:octocat:
View GitHub Profile
/**********************************************************************
*
* File: gmclj.c
*
* Create random ("gas") initial configuration for NVT-Monte Carlo of
* Lennard-Jonesium
*
* 12-May-2007 (MN)
* 17-Apr-2012
*
7 110 133 55 208 0.51171875 217 87 172 123 189 20 125 94 295 266 88 294 182 141 16 0 1 0.99609375 134 249 0 109 268 42 130 7 188 272 13 52 153 285 1 0 1 0.99609375 88 294 0 275 32 8 184 194 5 108 100 2 212 58 3 5 18 0.9765625 125 63 56 172 255 1 296 297 7 296 262 176 105 242 220 94 252 0.81640625 92 117 214 293 169 8 3 143 216 297 298 123 162 193 94 83 81 0.8984375 11 1 300 1 300 289 75 161 30 41 14 37 27 207 77 41 18 0.9453125 293 51 300 284 1 257 0 63 230 136 140 90 13 144 11 15 29 0.9375 220 290 298 295 251 18 76 143 114 277 120 231 280 44 131 96 108 0.7890625 114 259 166 41 21 295 231 294 8 235 27 32 187 41 239 209 168 0.67578125 184 133 202 294 232 41 116 67 104 55 92 194 216 254 57 10 1 0.84765625 179 295 196 90 184 123 151 11 212 33 143 260 100 100 251 247 253 0.9921875 224 290 274 76 267 75 165 168 116 22 212 269 34 209 4 1 13 0.99609375 62 17 14 135 0 297 183 256 77 102 120 70 265 214 100 43 22 0.828125 264 215 78 164 71 19 293 92 298 288 41 211 297 208 204 165 165 0.001 150 196 268 223 210 217 84 23
using System;
using System.Collections.Generic;
using System.Linq;
namespace flood {
class MainClass {
public static void Main(string[] args) {
while(true) {
Console.Clear();
@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;
@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
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 / 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
@oerpli
oerpli / Privacy Policy VLVZ Application
Created October 9, 2014 23:43
Privacy Policy VLVZ Application
No personal information will be collected or used.
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 / 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;