Skip to content

Instantly share code, notes, and snippets.

View ennorehling's full-sized avatar

Enno Rehling ennorehling

View GitHub Profile
static void register_loader(lua_State * L, const char * files_dir) {
char custom_path[PATH_MAX+1];
lua_getglobal(L, "package");
lua_getfield(L, -1, "loaders");
int num_loaders = lua_objlen(L, -1);
lua_pushcfunction(L, asset_loader);
lua_rawseti(L, -2, 2);
lua_pop(L, 1);
@ennorehling
ennorehling / adb_logcat.log
Created March 3, 2012 19:28
When I switch to the home screen and back to my app, this is my log output.
V/SDL ( 3377): onResume()
I/ActivityManager( 1396): Displayed activity org.libsdl.app/.SDLActivity: 478 ms (total 478 ms)
W/IInputConnectionWrapper( 1509): showStatusIcon on inactive InputConnection
V/SDL ( 3377): surfaceCreated()
V/SDL ( 3377): surfaceChanged()
V/SDL ( 3377): pixel format unknown -1
V/SDL ( 3377): Window size:480x270
I/SDL ( 3377): SDL_Android_Init()
I/SDL ( 3377): SDL_Android_Init() finished!
V/SDL ( 3377): Creating new EGL Surface
/*
I think I finally found a good use for precompiled headers.
If you want to compile in visual studio with maximum warning levels on, and your problem
is that the windows headers are shit, you can put them in the precompiled headers surrounded
by pragma warning disable magic
The difference between just including windows.h and EnableAllWarnings (/Wall) and doing
the following is 82 lines of warnings:
*/
#include <fcgiapp.h>
#include <stdlib.h>
const char * meta[] = {
"AUTH_TYPE",
"CONTENT_LENGTH",
"CONTENT_TYPE",
"GATEWAY_INTERFACE",
"PATH_INFO",
"PATH_TRANSLATED",
function recover(turn)
eressea.free_game()
eressea.read_game(turn .. ".dat")
ships = {}
bldgs = {}
for r in regions() do
for b in r.buildings do
if b.info~=nil and (string.len(b.info)>120) then
bldgs[b.id] = b.info
end
diff --git a/Rakefile b/Rakefile
index ae0765a..77bdbbc 100644
--- a/Rakefile
+++ b/Rakefile
@@ -9,7 +9,8 @@ ssh_port = "22"
document_root = "~/website.com/"
rsync_delete = false
rsync_args = "" # Any extra arguments to pass to rsync
-deploy_default = "rsync"
+weex_args = "-s blog"
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)
#!/bin/bash
str() {
foo() {
echo "fourty-two"
}
}
int() {
foo() {
@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
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) |_| |___| |_|