Skip to content

Instantly share code, notes, and snippets.

View rpetrich's full-sized avatar
Out with time lord dragon

Ryan Petrich rpetrich

Out with time lord dragon
View GitHub Profile
copy contents of /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk from official SDK to /var/sdk on iPhone
Install apt from Cydia
pushd /var/sdk/usr/lib
ln -s libgcc_s.1.dylib libgcc_s.10.5.dylib
ln -s dylib1.o dylib1.10.5.o
ln -s crt1.o crt1.10.5.o
ln -s libstdc++.6.0.9.dylib libstdc++.6.dylib
ln -s libstdc++.6.0.9.dylib libstdc++.dylib
ln -s libobjc.A.dylib libobjc.dylib
ln -s libSystem.B.dylib libSystem.dylib
@rpetrich
rpetrich / install-sdk
Created May 17, 2010 10:02
iPhone Toolchain installer script
#!/bin/sh
SDK=`dirname $0`
SCRIPT=`basename $0`
SDKPARENT=`dirname $SDK`
PLATFORM=`uname -sp`
if [ "$PLATFORM" = "Darwin i386" -o "$PLATFORM" = "Darwin x86_64" ]; then
echo "iPhone Toolchain installer script by rpetrich"
echo ""
<?
function genRandomString($length) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyz';
$string = '';
for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}
return $string;
}
#import <UIKit/UIKit.h>
#import <ActionMenu/ActionMenu.h>
@implementation UIResponder (TestAction)
- (BOOL)canDoTestAction:(id)sender
{
// Always
return YES;
}
@rpetrich
rpetrich / index.php
Created October 14, 2010 21:52
Twitter self-hosted image service/url shortener
<?
// Twitter self-hosted image service/url shortener by Ryan Petrich
// Installation:
// 1. Paste this script into the top of your HTTP root's index.php (rename index.html to index.php if it doesn't exist)
// 2. Add the following to your HTTP root's .htaccess file (create .htaccess if it doesn't exist):
// ErrorDocument 404 /index.php
// 3. Create a "s" subfolder and give it 777 permissions
// 4. Add the following as the custom URL for URL shortening in Twitter for iPhone's settings:
// http://yourdomain.com/?d=%@&p=password
// 5. Add the following as the custom URL for Image service:
@rpetrich
rpetrich / .bash_profile
Created February 19, 2011 01:21
Shell Bookmarks for Bash
# shell bookmarks; s <name> to save, l to list and g <name> to go
function s {
cat ~/.sdirs | grep -v "export DIR_$1=" > ~/.sdirs1
mv ~/.sdirs1 ~/.sdirs
echo "export DIR_$1=$PWD" >> ~/.sdirs
}
function l {
source ~/.sdirs
env | grep "^DIR_" | cut -c5- | grep "^.*=" | sort
}
@rpetrich
rpetrich / .gitignore
Created March 12, 2011 05:40
Replace codesigning in iOS apps and generate IPA files. By design, does not work with encrypted apps
embedded.mobileprovision
@rpetrich
rpetrich / .bash_profile
Created March 19, 2011 06:45
Battery/charging indicator for OS X
# Change prompt to include battery indicator
# Use some funky escapes so bash determines the proper prompt length
PS1='\w \[$(~/bin/battery.sh)\] \[\033[1D\] '
@rpetrich
rpetrich / ssh-colored
Created April 7, 2011 13:02
Changes the terminal settings when calling SSH
#!/bin/sh
function tabc {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi
osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"$NAME\""
}
function ctrl_c() {
tabc "Visor"
exit -1
}
@rpetrich
rpetrich / git-send-pull-request
Created April 16, 2011 14:50
Pushes the local branch up to the origin and opens the github pull request form in the browser
#!/bin/sh
ORIGIN=$1
if [ -e $1 ] ; then
ORIGIN=origin
fi
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
PROJECT=`git config --get remote.$ORIGIN.url | cut -f 2- -d : | cut -f 1 -d.`
git push $ORIGIN $BRANCH && open "https://github.com/$PROJECT/pull/new/$BRANCH"