Skip to content

Instantly share code, notes, and snippets.

View micahpearlman's full-sized avatar

Micah Pearlman micahpearlman

View GitHub Profile
Predicated execution on the NEON isn't too hard to get around. As in the code i posted you can translate:
if (cond) x = x1
else x = x0
To:
dx = x1 - x0;
x = x0;
x = x + (cond > 0) * dx;
@micahpearlman
micahpearlman / gist:1819124
Created February 13, 2012 19:08
Adding the static library’s headers in Xcode 4 worksspace

== Adding the static library’s headers ==

We also need to make sure that our app’s build target can locate the public headers used in this static library. Open the “Build Settings” tab and locate the “User Header Search Paths” setting. Set this to “$(BUILT_PRODUCTS_DIR)” (or “$(BUILT_PRODUCTS_DIR)/static_library_name” if we want to be more specific but then we’ll have to update this setting every time we add another library) and check the “Recursive” check box. Now our built target will search our workspace’s shared build directory to locate linkable header files.

** ALSO SET THE HEADERS TO PUBLIC!!! **

see: http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/

@micahpearlman
micahpearlman / gist:1878231
Created February 21, 2012 19:12
No ARC for specific files on iOS
If you get the error: dyld: lazy symbol binding failed: Symbol not found: _objc_retain
from: http://stackoverflow.com/questions/6308425/ios-5-best-practice-release-retain
When you migrate a project to use ARC, the -fobjc-arc compiler flag is set as the default for all Objective-C source files. You can disable ARC for a
specific class using the -fno-objc-arc compiler flag for that class. In Xcode, in the target Build Phases tab, open the Compile Sources group to
reveal the source file list. Double-click the file for which you want to set the flag, enter -fno-objc-arc in the pop-up panel, then click Done.
http://stackoverflow.com/questions/8112035/libobjc-a-dylib-compile-error-on-ios-4-3
@micahpearlman
micahpearlman / gist:2004122
Created March 8, 2012 23:32
Inkscape Command Line on OSX
/Applications/Inkscape.app/Contents/Resources/script "/path/to/myfile.svg" --export-png="/path/to/outputfile.png"
to export the image area (i.e., the image is off screen):
Applications/Inkscape.app/Contents/Resources/script "/Users/micahpearlman/killme/2.svg" --export-png="/Users/micahpearlman/killme/2.png" --export-area-drawing
@micahpearlman
micahpearlman / gist:2053525
Created March 16, 2012 23:12
XCode 4 IPA Archive with static libraries
Thanks but I needed 3 steps to entierly solve the problem with my project framework:
set the Target Build Settings/"Skip Installation" property to "YES" for every dependency project
clear the Target Build Settings "Installation Directory" property for every projects
for every projects, move every headers from section "Build Phases/Build Settings/Copy Headers" Public/Private to Project
see: http://stackoverflow.com/questions/5271496/xcode4-ios-4-3-no-packager-exists-for-the-type-of-archive
@micahpearlman
micahpearlman / BGRA2RGBA
Created April 27, 2012 19:55
BGRA to RGBA
// Really awesome code taken from: http://apangborn.com/2011/05/pixel-processing-using-arm-assembly/
inline static void neon_rgba_to_bgra(unsigned char *src, unsigned char *dst, int numPixels)
{
#ifdef __ARM_NEON__
int simd_pixels = numPixels & ~7; // round down to nearest 8
int simd_iterations = simd_pixels >> 3;
int col;
if(simd_iterations) { // make sure at least 1 iteration
__asm__ __volatile__ ("1: \n\t"
// structured load of 8 pixels into d0-d3 (64-bit) NEON registers
@micahpearlman
micahpearlman / gist:2865098
Created June 3, 2012 21:28
Downsample an Audio File
Using sox this is how you would downsample an audio file:
sox ./MM_intro_audio2.ogg -r 16000 ./MM_intro_audio3.ogg
Also to reduce the number of channels:
sox ./MM_intro_audio.ogg -c 1 ./MM_intro_audio2.ogg
@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"
@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 / 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.