Skip to content

Instantly share code, notes, and snippets.

View ennorehling's full-sized avatar

Enno Rehling ennorehling

View GitHub Profile
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) |_| |___| |_|
@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 ());
### 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:
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:
*/