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
/// This is free and unencumbered software released into the public domain. | |
/// | |
/// Anyone is free to copy, modify, publish, use, compile, sell, or | |
/// distribute this software, either in source code form or as a compiled | |
/// binary, for any purpose, commercial or non-commercial, and by any | |
/// means. | |
/// | |
/// In jurisdictions that recognize copyright laws, the author or authors | |
/// of this software dedicate any and all copyright interest in the | |
/// software to the public domain. We make this dedication for the benefit |
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 /path/to/directory -name "*.ext" -exec bash -c 'mv {} $(echo {} | sed -e "s/foo/bar/")' \; |
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
/* http://stackoverflow.com/questions/3128752/draw-line-in-uiview */ | |
- (void)drawRect:(CGRect)rect | |
{ | |
[super drawRect:rect]; | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor); | |
// Draw them with a 2.0 stroke width so they are a bit more visible. | |
CGContextSetLineWidth(context, 2.0f); |
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 | |
usage() | |
{ | |
printf "Supported commands:\n\tadd - adds all new files\n\tremove - removes all deleted files\n\tdiff - colorized diff\n" | |
exit 1 | |
} | |
if [ "$#" -eq "0" ]; then usage; fi | |
if [ $1 == "add" ]; then | |
svn st | grep ^? | sed 's/^\? *//' | xargs -I% svn add %@ |
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 | |
output=~/data.ab | |
package=${1:-"com.my.package"} | |
openssl="/usr/local/opt/openssl/bin/" | |
export PATH=$openssl:$PATH | |
adb -d backup -f $output -noapk $package | |
pushd ~ | |
dd if=$output bs=1 skip=24 | openssl zlib -d | tar -xvf - | |
rm $output |
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
for f in *.m4a; do atomicparsley "$f" --artwork folder.jpg; done; rm !(*temp*); for f in *.m4a; do g=${f//-temp*./.}; mv "$f" "$g"; done; |
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
I have got as far as: | |
git log -- [filename] | |
which shows me the commit history of the file, but how do I get at the content of each of the changes? | |
gitk [filename] | |
You can use |
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
If your grep supports the -r or -R option for recursive search, use it. | |
grep -r word . | |
Otherwise, use the -exec primary of find. This is the usual way of achieving the same effect as xargs, except without constraints on file names. Reasonably recent versions of find allow you to group several files in a single call to the auxiliary command. Passing /dev/null to grep ensures that it will show the file name in front of each match, even if it happens to be called on a single file. | |
find . -type f -exec grep word /dev/null {} + | |
Older versions of find (on older systems or OpenBSD, or reduced utilities such as BusyBox) can only call the auxiliary command on one file at a time. |
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
function changes() { | |
if [ "$1" = "show" ] | |
then | |
git log -n 10 --no-merges | |
elif [ "$1" = "get" ] | |
then | |
git pull --rebase | |
elif [ "$1" = "post" ] | |
then | |
git push |
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
pushd ~/.android/avd/$1.avd/ | |
sed -i .bak 's/\(window.[xy] = \)-*[0-9]*/\10/g' emulator-user.ini | |
popd | |
pushd ~/android-sdks/tools/ | |
if [ ! -z "$2" ]; then | |
emulator @$1 -scale $2 | |
else | |
emulator @$1 | |
fi | |
popd |
NewerOlder