sudo perl -MCPAN -e shell
o conf init
Move Podcast track from Podcast to Music in iTunes
Once in a while there’s a song in the Stereo gum mp3 feed that I actually want to keep. Here’s how I do it.
- Select the podcasts you wish to convert to normal audio files.
- Right click and select “Convert ID3 tags”.
- Change the ID3 tags to version 1.0
- Drag the podcast tracks out to your Desktop
- Delete the originals from iTunes
- Drag the files back in to iTunes
- Change the ID3 tags back to the highest version available.
- Fix any missing tags.
Works like a charm for me.
Xargs choking on whitespace
Every once in a while the normal recursive bash command doesn’t work and I resort to using find with xargs. Of course xargs hates whitespace and I often find myself working with files created by others. xargs chokes on whitespace thinking it’s an indication of a new file. The solution is to get find to send null separated values instead of newline separated values, and get xargs to check for null characters instead of newlines. Both can be accomplished, find’s -print0 sends null values, xarg’s -0 will accept null values.
Here’s an example:
find ./website/ ! -perm -775 -print0 | xargs -0 chown production:wheel
via linuxdevcenter
Enable Emoji icons on the iPhone
So far this has started to work on the latest (2.2) firmware for the iPhone.
You need to edit the file /User/Library/Preferences/com.apple.Preferences.plist on the device ->
I found it best to sftp in to the phone, make a backup, and edit the file using Apple’s Property List Editor. Copy the file back to /User/Library/Preferences/ . On the iPhone go to Settings -> General -> Keyboard -> International Keyboards -> Japanese and enable Emoji. That’s it.
Catching System output from Perl
I’m too lazy to install a perl module, on a local computer, for a quick whois on a few domains. Catching the shell’s output is more convenient in this case.
Instead of first writing and then reading from a file, it makes more sense to use a pipe. Here’s a quick example:
#!/usr/bin/perl
open (WHOIS, "/usr/bin/whois ewayauto.com |");
$i=1;
while (
print "Line # ".$i." ".$_;
$i++;
}
print "All done!\n";
close WHOIS;
Thanks to netadmintools for this one.
Bluetooth Proximity Detection on OS X
I use this to lock and unlock my Mac, at work, based on the bluetooth connection between my phone and computer. Once my Mac detects that the phone is unavailable it locks itself.
What you’ll need:
- Proximity 1.0 a free download from Apple.
- A compiled version of notify.c
#include
int main(int argc, char ** argv)
{
CFMessagePortRef port = CFMessagePortCreateRemote(NULL, CFSTR("com.apple.loginwindow.notify"));
CFMessagePortSendRequest(port, 500, 0, 0, 0, 0, 0);
CFRelease(port);
return 0;
}
You can download a pre-compiled version here, or compile it yourself (Apple’s Dev Tools required) with the command
cc -arch ppc -arch i386 -o notif notif.c -framework CoreFoundation - An Apple Script to set the screen saver
-- Turn on the screen saver password
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 1"
set MyName to do shell script "whoami"
set runFile to "/Users/" & MyName & "/notif"
-- display dialog runFile
do shell script runFile
-- Activate the screen saver
tell application "ScreenSaverEngine" to activate
N.B. You’ll need to change “/notif” to match the location if the compiled notif binary - An Applescript to unset the screensaver.
-- Disable the screen Saver Password
set MyName to do shell script "whoami"
set runFile to "/Users/" & MyName & "/notif"
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 0"
do shell script runFile
-- Turn OFF the screen saver
tell application "ScreenSaverEngine" to quit
N.B. You’ll need to change “/notif” to match the location if the compiled notif binary - Connect your bluetooth device to the Mac via bluetooth.
- Run Proximity, set your device, set the Applescripts
Useful Links:
- Lock Computer Using DeskShade
- Bluetooth Proximity Detection on OS X
- Automatically turn on/off Password Protection for the Screensaver
Update:
Mac OS X Hints has a much better setup.
Find current user with in an Applescript
I’m in the middle of testing this, but it should work:
set MyName to do shell script "whoami"
Custom Ringtones and SMS alerts for hacked iPhones
This is really here for me to keep track of.
Life in 0 and 1 has a nice little tutorial on how to change SMS alerts on a hacked iPhone.
This is for hacked iPhones only. You can pick up quickpwn here