Skip to content

Instantly share code, notes, and snippets.

View roSievers's full-sized avatar

Rolf Kreibaum roSievers

View GitHub Profile
@roSievers
roSievers / dinnerhopping
Created January 22, 2019 20:51
Skript um Dinnerhopping zu optimieren
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Ein Dinnerhopping soll organisiert werden.
# Es nehmen 42 Personen in 21 Teams teil.
n_teams = 21
from random import randrange
@roSievers
roSievers / gist:dbf1d2115d9af96f7e886c17d6259dbe
Created November 30, 2016 07:52
Anura crashing again, after update
/home/rolf/Downloads/anura [git::trunk *] [rolf@Butterfly] [8:50]
> ./anura --module=citadel --auto-update-module
INFO: main.cpp:439 : Anura engine version 1.4
INFO: main.cpp:478 : Default Tile Size: 16
INFO: main.cpp:479 : Default Tile Scale: 2
INFO: main.cpp:481 : Build Options:
INFO: main.cpp:483 : isomap
INFO: main.cpp:483 : lua
INFO: main.cpp:483 : save_png
INFO: main.cpp:483 : sdl2
# A LOT of these, where it correcty downloads:
INFO: http_client.cpp:65 : http_client::send_request(this = 0xa1262f0 @60968 method_path = POST /download_chunk?chunk_id=96dc6299c8212b5020186f8c8cfd5341 request.size() = 78 num_retries = 0 attempt_num = 1)
INFO: http_client.cpp:431 : http_client::handle_recv: 0xa8822e0 @60970 payload_str.size() = 1235
INFO: module.cpp:1257 : Module request chunk: 44d2275f489dd630c661fbb728f57d14
INFO: http_client.cpp:65 : http_client::send_request(this = 0xaa604b0 @60970 method_path = POST /download_chunk?chunk_id=44d2275f489dd630c661fbb728f57d14 request.size() = 78 num_retries = 0 attempt_num = 1)
/home/rolf/Downloads/argentum-age [rolf@Butterfly] [21:32]
> ldd ./bin/anura
linux-gate.so.1 (0xf77b2000)
libGL.so.1 => /usr/lib32/libGL.so.1 (0xf770b000)
libGLEW.so.1.10 => not found
libSDL2_image-2.0.so.0 => not found
libSDL2-2.0.so.0 => not found
libz.so.1 => /usr/lib32/libz.so.1 (0xf76f4000)
libfreetype.so.6 => /usr/lib32/libfreetype.so.6 (0xf7631000)
libcairo.so.2 => not found
./run.sh
INFO: main.cpp:439 : Anura engine version 1.4
INFO: main.cpp:478 : Default Tile Size: 16
INFO: main.cpp:479 : Default Tile Scale: 2
INFO: main.cpp:481 : Build Options:
INFO: main.cpp:483 : isomap
INFO: main.cpp:483 : lua
INFO: main.cpp:483 : save_png
INFO: main.cpp:483 : sdl2
INFO: main.cpp:483 : svg
@roSievers
roSievers / onRightClick.elm
Created October 23, 2016 18:13
OnRightClick can't be implemented using onWithOptions.
import Html exposing (div, button, text)
import Html.App exposing (beginnerProgram)
import Html.Events exposing (onClick, onWithOptions)
import Json.Decode as Json
main =
beginnerProgram { model = 0, view = view, update = update }
#https://math.stackexchange.com/questions/1189554/number-of-pairs-formed-from-2n-people-sitting-in-a-circle#1189713
import math, operator
product = lambda l: reduce(operator.mul, l, 1)
def binom(n,k): # https://stackoverflow.com/questions/26560726/python-binomial-coefficient
if (k > n) or (k < 0):
return 0
return product(xrange(k+1, n+1)) // math.factorial(n-k)
@roSievers
roSievers / pirates.py
Last active August 29, 2015 14:09 — forked from robket/pirates.py
import math
def distributionWithNPirates(n):
if (n == 1): # Base case
return [100]
numberOfVotesRequired = int(math.ceil(n / 2.0))
# Pirate n will vote for his proposal regardless
numberOfVotesRequired -= 1
distributionIfPirateNKilled = distributionWithNPirates(n - 1)
piratesThatGetTheLeastIfPirateNIsKilled = sorted(range(len(distributionIfPirateNKilled)), key=distributionIfPirateNKilled.__getitem__)
@roSievers
roSievers / bandboxing-now-with-less-closures.js
Last active August 29, 2015 14:08
Bandboxing - Ripping apart the input code.
// This module takes care of the so called Bandbox. The component
// used to select several units at once by drawing a rectangle.
// In particular, it provides an event handling Object "bandboxing"
// used by handleInputBeforeGui in input.js.
// The Pyrogenesis engine can only import whole javascript modules.
// To prevent interference with other code this module is encapsulated
// in an object.
// First we create a new object, which can be used as an event processor
@roSievers
roSievers / Member Title Remover (Wildfiregames)
Last active August 29, 2015 14:06
UserScript: Removs the member_titles on the wildfiregames forums
// ==UserScript==
// @id MemberTitleRemoverWildfiregames
// @name Member Title Remover (Wildfiregames)
// @namespace http://www.diasp.de/u/rosievers
// @description Removs the member_titles on the wildfiregames forums
// @author Rolf Sievers
// @include http://www.wildfiregames.com/forum/*
// @version 1
// @grant none
// @licence http://creativecommons.org/publicdomain/zero/1.0/