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/bash | |
cd | |
export myhomepath=`pwd` | |
sudo defaults write com.apple.loginwindow LoginHook $myhomepath/Library/Scripts/mute-off.sh | |
sudo defaults write com.apple.loginwindow LogoutHook $myhomepath/Library/Scripts/mute-on.sh | |
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/bash | |
# Bah. I prefer spaces. So why this script? I was on a project that required tabs. | |
export isconfirmed=$1 | |
if [[ ! "$isconfirmed" == 'confirmed' ]]; then | |
echo 'run with a "confirmed" command line argument to confirm you want to run this destructive operation' | |
exit -1 | |
fi |
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/bash | |
export log=$1 | |
export dsym=$2 | |
export app=$3 | |
if [[ "$app" == '' ]]; then | |
echo usage: $0 '<logfile> <dSYM folder> <.app folder>' | |
echo | |
exit -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
#!/bin/bash | |
export key=$1 | |
export data=$2 | |
export __KEYSTORE__=$3 | |
if [[ "$data" == '' ]]; then | |
echo usage: $0 '<"key text"> <"data text"> [keystore_name]' | |
echo | |
echo " for multi-line data, put in file and do:" |
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
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations -q otimized.png reverted.png | |
# or if Xcode is in a non-standard path: | |
"`xcode-select -print-path`"/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations -q otimized.png reverted.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
xcode-select -print-path | |
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/bash | |
# requires ack: http://betterthangrep.com/ | |
# is there a better way to pass in the arguments to this perl one-liner other than using the environment? pretty hacky. could just rewrite the whole thing as a Perl script using File::Find | |
# todo: redo this to use find, xargs, and grep in case ack isn't available | |
# todo: this looks only for files in a "Source" directory; generalize it | |
export old=$1 | |
export new=$2 |
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
#!/usr/bin/perl | |
# requires imagemagick to be installed on the system for 'identify' and 'convert' | |
use strict; | |
use warnings; | |
my $infile = shift; | |
my $color = shift; |
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
git stash save | |
git branch xxx HEAD | |
git checkout xxx | |
git stash pop | |
or do: | |
git checkout -b xxx | |
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
# regexps to check if a string is pure chinese | |
class String | |
# 20k chars | |
CHINESE_UCS2 = /^(?: | |
[\x4e-\x9e][\x00-\xff] | |
|\x9f[\x00-\xa5] | |
)+$/xn | |
# 20k chars | |
CHINESE_UTF8 = /^(?: |