Skip to content

Instantly share code, notes, and snippets.

View haxpor's full-sized avatar
🤓
Some of my financial tools https://www.mql5.com/en/users/haxpor/seller

Wasin Thonkaew haxpor

🤓
Some of my financial tools https://www.mql5.com/en/users/haxpor/seller
View GitHub Profile
@haxpor
haxpor / doubledragon-crashlog-openbor.log
Last active May 2, 2019 22:22
based on openbor 5693594c84c95620acd82edbeae1d102a4ab89c7 (minor_androidbuild)
-- note: when picked up weapon then use it -> crash --
ActivityManager: Displayed org.openbor.engine/org.libsdl.app.SDLActivity: +400ms
05-03 01:56:55.522 1516 1582 I WindowManager: Screen frozen for +400ms due to Window{69c84ba u0 Starting org.openbor.engine}
05-03 02:00:29.479 563 563 F DEBUG : pid: 7229, tid: 7247, name: SDLThread >>> org.openbor.engine <<<
05-03 02:00:29.509 563 563 F DEBUG : #00 pc 0006ecd2 /data/app/org.openbor.engine-1/lib/arm/libopenbor.so (checkhit+125)
05-03 02:00:29.510 563 563 F DEBUG : #01 pc 000713f9 /data/app/org.openbor.engine-1/lib/arm/libopenbor.so (do_attack+224)
05-03 02:00:29.511 563 563 F DEBUG : #02 pc 00074551 /data/app/org.openbor.engine-1/lib/arm/libopenbor.so (update_ents+212)
05-03 02:00:29.511 563 563 F DEBUG : #03 pc 0006452f /data/app/org.openbor.engine-1/lib/arm/libopenbor.so (update+1330)
05-03 02:00:29.511 563 563 F DEBUG : #04 pc 00089277 /data/app/org.openbor.engine-1/lib/arm/libopenbor.so (pl
@haxpor
haxpor / doubleptr_cleanup.c
Created May 1, 2019 17:06
example c code to test out double pointer cleaningup
#include <stdio.h>
#include <stdlib.h>
typedef struct
{
int val;
} MyStruct;
void cleanup(MyStruct** s)
{
@haxpor
haxpor / gifclrmp-symbol.dump
Created May 1, 2019 09:11
dump of symbol of gifclrmp for inspection
Symbol table '.dynsym' contains 57 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND free@GLIBC_2.2.5 (2)
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND strncpy@GLIBC_2.2.5 (2)
3: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab
4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __isoc99_fscanf@GLIBC_2.7 (3)
5: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DGifGetLine
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fclose@GLIBC_2.2.5 (2)
7: 0000000000000000 0 FUNC GLOBAL DEFAULT UND DGifCloseFile
@haxpor
haxpor / h4-imagemagick.log
Created April 29, 2019 08:04
h4.gif result from `identify -verbose h4.gif`
Image: h4.gif
Format: GIF (CompuServe graphics interchange format)
Mime type: image/gif
Class: PseudoClass
Geometry: 97x111+0+0
Units: Undefined
Colorspace: sRGB
Type: Palette
Base type: Undefined
Endianess: Undefined
@haxpor
haxpor / toonshad-model.frag
Last active April 23, 2019 11:25
Toon shading for model. Thanks for great tutorial https://bit.ly/2KZyseQ by Erik Roystan Ross
// toonshader, see https://roystan.net/articles/toon-shader.html
// but this time with input model file
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_tex0Resolution;
uniform vec3 u_lightColor;
@haxpor
haxpor / test_vec4_distance.c
Last active April 18, 2019 19:12
test case to test glm_vec4_distance running on Android device (armv7 or 8 capable) according to issue #82 of cglm on github
CGLM_ALIGN(16) vec4 v1;
CGLM_ALIGN(16) vec4 v2;
float d1, d2;
for (int i=0; i<1000; ++i)
{
test_rand_vec4(v1);
test_rand_vec4(v2);
d1 = glm_vec4_distance(v1, v2);
d2 = sqrtf(powf(v1[0]-v2[0], 2.0f) + pow(v1[1]-v2[1], 2.0f) + pow(v1[2]-v2[2], 2.0f) + pow(v1[3]-v2[3], 2.0f));
if (fabsf(d1 - d2) > 0.000009)
@haxpor
haxpor / Android.mk
Last active April 20, 2019 19:44
Android.mk to build krr for sample project for Android. All dependencies are pre-built and installed into NDK's sysroot according to selected NDK version.
LOCAL_PATH := $(call my-dir)
# our prebuilt libraries
# - MPG123
include $(CLEAR_VARS)
LOCAL_MODULE := MPG123
LOCAL_SRC_FILES := $(ANDROID_NDK_SYSROOT)/usr/lib/$(TARGET_ARCH_ABI)/libmpg123.so
include $(PREBUILT_SHARED_LIBRARY)
@haxpor
haxpor / sgets_improved.c
Last active April 16, 2019 23:40
Improved sgets implementation. Notice that if you allocate input string dynamically, you need to save original pointer to free it later.
lude <stdio.h>
#include <string.h>
#include <stdlib.h>
static char* sgets(char* dst_str, int dst_size, char** input_str)
{
// safety check, probably removed out in performance-centric code
if (input_str == NULL || *input_str == NULL)
return NULL;
@haxpor
haxpor / sgets.c
Created April 16, 2019 10:30
equivalent of fgets() but works on string instead of file
// equivalent to fgets() but works on string instead of file
/*
* Equivalent to fgets() but operate on string instead of file.
* It will read string upto `dst_size` or stop reading whenever find newline character,
* then return string so far as read via `dst_str`.
*
* `offset` will be updated according to the current number of bytes read.
* First call should always set it to 0, then consecutive call will be automatically updated by
* this function, just re-supply it in the function call.
*
@haxpor
haxpor / ndk-build-cmds.md
Created April 14, 2019 08:17
ndk-build commands for convenient
  • ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_PLATFORM=android-18 APP_ABI=armeabi-v7a
  • ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk APP_PLATFORM=android-21 APP_ABI=arm64-v8a