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
- (BOOL) addSkipBackupAttributeToItemAtURL:(NSURL *)URL | |
{ | |
const char* filePath = [[URL path] fileSystemRepresentation]; | |
const char* attrName = "com.apple.MobileBackup"; | |
u_int8_t attrValue = 1; | |
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0); | |
return result == 0; | |
} |
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
ifdown eth0 | |
ifup eth0 | |
iwconfig eth0 essid networkname key [hex key, all caps] | |
ifconfig | |
# so if your network name is 'startrekenterprise' and your key is 'ABCDEFGHI' the command is | |
# iwconfig eth0 essid startrekenterprise ABCDEFGHI | |
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 | |
use LWP::Simple; | |
use strict; | |
use warnings; | |
my $content = get("feed://www.google.com/trends/hottrends/atom/hourly"); | |
die "Could not retrieve feed" unless defined ($content); |
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
<?xml version="1.0"?> | |
<BusinessCard> | |
<firstName>Joe</firstName> | |
<lastName>Smith</lastName> | |
<phone class="work">408-555-5555</phone> | |
<phone class="home">408-555-8888</phone> | |
<phone class="cell">408-555-2222</phone> | |
<phone class="fax">408-555-1111</phone> | |
</BusinessCard> |
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 | |
use XML::XPath; | |
use strict; | |
use warnings; | |
my $file = shift; | |
my $path = shift; | |
unless (defined($path) && -e $file) { |
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
My notes on using watir. This is from 2007 so it's a bit out of date. | |
The part starting with "Cheat Sheet" is cribbed from some long-forgotten web site. | |
Watir can be used with other browsers but this is Firefox-specific. | |
1. install Firefox 1.5 or higher | |
2. install jssh extension | |
3. close firefox |
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
# throttle bandwidth | |
sudo ipfw pipe 1 config bw 15KByte/s | |
sudo ipfw add 1 pipe 1 src-port 80 | |
# restore | |
sudo ipfw delete 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
# add 'source .gitprompt' to .bashrc to use this | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
function proml { | |
local BLUE="\[\033[0;34m\]" | |
local RED="\[\033[0;31m\]" | |
local LIGHT_RED="\[\033[1;31m\]" |
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
# put in .bashrc | |
pman () { | |
if [ "${2}" == '' ]; then | |
man -t "${1}" | open -f -a /Applications/Preview.app | |
else | |
man -t "${1}" "${2}" | open -f -a /Applications/Preview.app | |
fi | |
} |