Skip to content

Instantly share code, notes, and snippets.

View ennorehling's full-sized avatar

Enno Rehling ennorehling

View GitHub Profile

TODO

disabled tests

wegen reduce_skill:

  • test_exp_drain
  • test_foolpotion
  • test_mistletoe_okay
-- ./eressea -v0 -t 858 shipinfo.lua > ships.txt
require 'config'
eressea.read_game(get_turn() .. ".dat")
for r in regions() do
for s in r.ships do
if s.info:len()>120 then
print(s.id, s.info)
end
end
-- ./eressea -v0 -t 1001 shipfix.lua
require 'config'
infos = {}
for line in io.lines("ships.txt") do
id = string.match(line, "^(%d+)%s*")
info = line:sub(id:len()+2)
infos[tonumber(id)] = info
end
local function curse(r)
if not r:get_flag("rain") then
msg = message.create("rain")
msg:set_region("region", r)
msg:send_region(r)
r:set_flag("rain")
end
end
function rain.update(id)
### Keybase proof
I hereby claim:
* I am ennorehling on github.
* I am ennorehling (https://keybase.io/ennorehling) on keybase.
* I have a public key whose fingerprint is 896F F20D 7F47 3AC0 2997 FC24 2270 9561 3871 3193
To claim this, I am signing this object:
@ennorehling
ennorehling / valgrind_strtod.c
Created June 9, 2015 05:51
This program makes valgrind complain about an invalid read in strtod
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gnu/libc-version.h>
int main(void) {
char *endp;
char *str = strdup("id");
double ld;
puts (gnu_get_libc_version ());
#!/bin/bash
logo="
$(tput setaf 2).~~. .~~.$(tput sgr0)
$(tput setaf 2)'. \ ' ' / .'$(tput sgr0)
$(tput setaf 1).~ .~~~..~.$(tput sgr0) _ _
$(tput setaf 1): .~.'~'.~. :$(tput sgr0) ___ ___ ___ ___| |_ ___ ___ ___ _ _ ___|_|
$(tput setaf 1)~ ( ) ( ) ~$(tput sgr0) | _| .'|_ -| . | . | -_| _| _| | | | . | |
$(tput setaf 1)( : '~'.~.'~' : )$(tput sgr0) |_| |__,|___| _|___|___|_| |_| |_ | | _|_|
$(tput setaf 1)~ .~ ( ) ~. ~$(tput sgr0) |_| |___| |_|
@ennorehling
ennorehling / hex_encode
Created March 4, 2015 10:45
Hex encoding in C
void hex_encode(unsigned char * in, size_t inlen, char * out) {
size_t i;
for (i=0;i!=inlen;++i, out+=2) {
sprintf(out, "%02x", in[i]);
}
}
char digest[16] = "some_random_data";
char buffer[64];
hex_encode(digest, sizeof(digest), buffer);
#!/bin/bash
str() {
foo() {
echo "fourty-two"
}
}
int() {
foo() {
function new_faction(email, race, lang, r)
f = faction.create(email, race, lang)
u = unit.create(f, r, 10)
u:add_item("log", 5);
u:add_item("horse", 2);
u:add_item("silver", 1000);
u:add_item("adamantium", 1);
end
function get_homes(f)