This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#define DEREFENCE_MODE 1 | |
#define IS_ALIGNED(P_tr) \ | |
(((uintptr_t) (P_tr) & 3) == 0 ? "YES" : "NO") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export NDK=/tmp/android-ndk-r8b | |
# Create the standalone toolchain | |
$NDK/build/tools/make-standalone-toolchain.sh \ | |
--platform=android-9 \ | |
--install-dir=/tmp/my-android-toolchain | |
export PATH=/tmp/my-android-toolchain/bin:$PATH | |
export SYSROOT=/tmp/my-android-toolchain/sysroot | |
export CC="arm-linux-androideabi-gcc --sysroot $SYSROOT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from https://github.com/erica/uidevice-extension/blob/master/UIDevice-Hardware.m | |
iFPGA -> ?? | |
iPhone1,1 -> iPhone 1G, M68 | |
iPhone1,2 -> iPhone 3G, N82 | |
iPhone2,1 -> iPhone 3GS, N88 | |
iPhone3,1 -> iPhone 4/AT&T, N89 | |
iPhone3,2 -> iPhone 4/Other Carrier?, ?? | |
iPhone3,3 -> iPhone 4/Verizon, TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
struct foo { | |
int count; | |
const char *misc; | |
}; | |
typedef struct foo * pfoo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#include <string.h> | |
static char *mysprintf(const char *format, ...); | |
int main(void) { | |
char *str = mysprintf("%s fmt with various values: PI ~= %.2f", "Test", 3.14); | |
printf("%s (len = %zd)\n", str, strlen(str)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <assert.h> | |
#include <msgpack.h> | |
typedef struct some_struct { | |
uint32_t a; | |
uint32_t b; | |
float c; | |
} some_struct; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
const char *g_progname; | |
const char *g_name; | |
struct seq { | |
int *vals; | |
int size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
static int append(char **str, const char *buf, int size); | |
int main(void) { | |
char *str = NULL; | |
append(&str, "this", 4); | |
append(&str, " is", 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function split { # file, target_size | |
_w=$(identify -format "%w" $1) | |
_dx=$(( ($_w - $2) / 2 )) | |
convert $1 -crop 50%x100% +repage parts.png | |
convert parts-0.png -gravity East -chop ${_dx}x0 left.png | |
convert parts-1.png -gravity West -chop ${_dx}x0 right.png | |
montage -background none left.png right.png -mode Concatenate -tile x1 out.png | |
rm parts*.png left.png right.png | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -# -F file=@"foo.mov" http://192.168.0.38:8888/upload.json >/dev/null |