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 http://joeyh.name/code/moreutils/ Makefile | |
# See http://blog.liw.fi/posts/errno/ for all the details about `errno` CLI tool | |
errno.o: errnos.h | |
errnos.h: | |
echo '#include <errno.h>' > dump.c | |
$(CC) -E -dD dump.c | awk '/^#define E/ { printf "{\"%s\",%d},\n", $$2, $$3 }' > errnos.h | |
rm -f dump.c | |
# On errno.c side this auto-generated header is used as follow | |
# -- |
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
# 1/ Read EXIF orientation flag | |
identify -format "%[EXIF:orientation]" myimage.jpg | |
# NOTE: jhead can be used too | |
# see http://www.sentex.net/~mwandel/jhead/ | |
jhead -exifmap myimage.jpg | grep Ori | |
# 2/ Remove EXIF orientation | |
# i.e. rotate the image accordingly and reset the orientation | |
# flag to 1 (default, i.e. origin = TopLeft) |
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
# Find the right Clang path for iOS cross-compilation | |
xcrun -sdk iphoneos -find clang | |
# Pick the right tool and run the command (here list #define-s) | |
xcrun -sdk iphoneos clang -E -dM - < /dev/null |
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
/** | |
* How to use it | |
* -- | |
* brew install tokyo-cabinet | |
* clang -o b64 b64.c -Wall -Werror -I/usr/local/include -L/usr/local/lib -ltokyocabinet | |
* ./b64 | |
* ./b64 Zm9v | |
*/ | |
#include <stdio.h> |
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
--- armv7.txt 2012-09-26 16:03:39.000000000 +0200 | |
+++ armv7s.txt 2012-09-26 16:03:45.000000000 +0200 | |
@@ -3,8 +3,9 @@ | |
#define __APPLE_CC__ 5621 | |
#define __APPLE__ 1 | |
#define __ARMEL__ 1 | |
-#define __ARM_ARCH_7A__ 1 | |
+#define __ARM_ARCH_7S__ 1 | |
#define __ARM_NEON__ 1 | |
+#define __ARM_VFPV4__ 1 |
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 <string.h> | |
#include <json-parser/json.h> | |
int main(int argc, char *argv[]) { | |
char *str[] = { "{\"foo\": \"bar\"}" /* ok */, "{\"foo\": \"bar}" /* ko */ }; | |
for (int i = 0; i < 2; i++) { | |
json_settings settings; | |
memset(&settings, 0, sizeof(json_settings)); |
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
# 1. Use the tools from the Standalone Toolchain | |
export PATH=/tmp/my-android-toolchain/bin:$PATH | |
export SYSROOT=/tmp/my-android-toolchain/sysroot | |
export CC="arm-linux-androideabi-gcc --sysroot $SYSROOT" | |
export AR=arm-linux-androideabi-ar | |
# 2. Clone the Github mirror | |
git clone git://github.com/noct/jsmn.git; cd jsmn | |
# 3. Build for the ARMv7 ABI |
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
require 'torch' | |
local argcheck = require 'argcheck' | |
local env = require 'argcheck.env' | |
function env.istype(obj, typename) | |
if typename == 'torch.Tensor' then | |
-- could also check the storage type! | |
return torch.isTensor(obj) | |
else |
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 <curl/curl.h> | |
int | |
main(void) | |
{ | |
curl_version_info_data *info = curl_version_info(CURLVERSION_NOW); | |
printf("async DNS: %d\n", !!(info->features & CURL_VERSION_ASYNCHDNS)); | |
return 0; | |
} |
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 |