Skip to content

Instantly share code, notes, and snippets.

View micahpearlman's full-sized avatar

Micah Pearlman micahpearlman

View GitHub Profile
@micahpearlman
micahpearlman / .vimrc
Created February 28, 2013 20:30
basic .vimrc to fix arrow keys and backspace
"# fixes arrow keys
set nocompatible
"# fixes backspace/delete
set backspace=indent,eol,start
@micahpearlman
micahpearlman / gist:4678734
Created January 31, 2013 00:24
Release build get weird memory access crashes use "volatile"
Release build get weird memory access crashes use "volatile"
like:
volatile int = 5;
@micahpearlman
micahpearlman / gist:4644500
Created January 26, 2013 20:41
Build an OpenCV framework for iOS
see: http://docs.opencv.org/doc/tutorials/introduction/ios_install/ios_install.html
Installation in iOS
Required Packages
CMake 2.8.8 or higher
Xcode 4.2 or higher
Getting the Cutting-edge OpenCV from Git Repository
Launch GIT client and clone OpenCV repository from here
In MacOS it can be done using the following command in Terminal:
@micahpearlman
micahpearlman / gist:4644484
Created January 26, 2013 20:38
When doing an XCode AdHoc (or any custom) build in an XCode workspace, Xcode cannot find the other projects in the workspace. To fix it do the following:
see: http://stackoverflow.com/questions/8523690/xcode-custom-build-configuration-causes-library-file-not-found-for-static-libr
In the project with the Adhoc build configuration, override the "Per-configuration Build Products Path" (CONFIGURATION_BUILD_DIR) and "Per-configuration Intermediate Build Files Path" (CONFIGURATION_TEMP_DIR) for the Adhoc build configuration to use the same folder as the release configuration.
Adhoc: CONFIGURATION_BUILD_DIR = $(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME)
Adhoc: CONFIGURATION_TEMP_DIR = $(PROJECT_TEMP_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
Now when you do an Adhoc build, Xcode will put libFoo.a and Bar.app in the Release-iphoneos folder. The linker will be happy and you can use -force_load $(BUILT_PRODUCTS_DIR)/libFoo.a as usual.
Alternatively, you can add the Release-iphoneos folder to the library search paths for the Adhoc build configuration:
@micahpearlman
micahpearlman / gist:4562041
Created January 18, 2013 03:02
Use fmemopen to create a file descriptor (FILE) for data already in memory.
Use fmemopen to create a file descriptor (FILE) for data already in memory.
see: http://www.kernel.org/doc/man-pages/online/pages/man3/fmemopen.3.html
for iOS/OSX version see: https://github.com/jverkoey/fmemopen
@micahpearlman
micahpearlman / gist:4561519
Created January 18, 2013 01:22
Compile GLSL shaders into a C include file
#NOTE: because xxd doesn't emit a \0 null character we use sed to add that extra bit
#see: http://gamesfromwithin.com/quick-tip-working-with-shaders-on-ios
cd ${INPUT_FILE_DIR}
xxd -i ${INPUT_FILE_NAME} | sed s/}\;/,0x00}\;/ > ${INPUT_FILE_PATH}.h
@micahpearlman
micahpearlman / cross-compile.config
Created January 12, 2013 19:44
crosstools-ng Pollux cross compiler on Mac OSX configuration file. NOTE: you will need gnu sed and grep (and maybe some other stuff) to get this to work. Also, need to build off of the LF linux kernel (http://files.poxlib.org/LF-Linux-8291-20101026-1425.tar.gz). Also, if you harddrive volume is not set as case-sensitive (most aren't) you will ne…
#
# Automatically generated make config: don't edit
# crosstool-NG 1.17.0 Configuration
# Thu Jan 10 16:32:17 2013
#
CT_CONFIGURE_has_xz=y
CT_CONFIGURE_has_cvs=y
CT_CONFIGURE_has_svn=y
CT_MODULES=y
@micahpearlman
micahpearlman / gist:4490218
Created January 9, 2013 03:04
How to root Android Galaxy Player 4.0
http://forum.xda-developers.com/showthread.php?t=1424358
Hello All,
I just bought a Galaxy Player yesterday and wanted to root. Okay, I thought, to XDA I go. It seems the general consensus here is to use SuperOneClick.
While the SuperOneClick method may work for most people running Windows, it's fairly annoying for those in the Linux and Mac crowd. It sometimes may work after installing the correct mono application and libraries, but that's quite a bit to download.
So, I thought it'd be nice to have only one thing to download, extract, and run the root all of the Galaxy Players on all platforms.
@micahpearlman
micahpearlman / gist:4355214
Created December 21, 2012 19:38
Create a flattened bundle script for iOS
#!/bin/bash
# see: http://stackoverflow.com/questions/2578496/creating-my-own-bundle-in-xcode-for-iphone-application
echo "Building assets bundle."
if [ -d ./MyAssets.bundle ]; then
rm ./MyAssets.bundle/*
else
mkdir ./MyAssets.bundle
fi
find ./assets -type f -print0 | xargs -0 -J% cp % ./MyAssets.bundle
@micahpearlman
micahpearlman / auto-increment.sh
Created December 2, 2012 19:51
Auto increment build numbers in XCode
#!/bin/bash
#### see: http://stackoverflow.com/questions/10091310/heres-how-to-auto-increment-the-build-number-in-xcode
bN=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
bN=$((0x$bN))
bN=$(($bN + 1))
bN=$(printf "%X" $bN)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bN" "$INFOPLIST_FILE"