日期Calendar
QuicksearchCategories |
Monday, December 3. 2007Fix for Tor on Leopard
After installing Mac OS X 10.5 (Leopard) fresh (I won't go into details
# Create Tor Group and User: sudo dscl . -create /Groups/_tor sudo dscl . -create /Groups/_tor PrimaryGroupID 100 sudo dscl . -create /Groups/_tor RealName "Tor Group" sudo dscl . -create /Groups/_tor Password '*' sudo dscl . -create /Users/_tor sudo dscl . -create /Users/_tor UserShell /usr/bin/false sudo dscl . -create /Users/_tor RealName "Tor Server" sudo dscl . -create /Users/_tor UniqueID 100 sudo dscl . -create /Users/_tor PrimaryGroupID 100 sudo dscl . -create /Users/_tor NFSHomeDirectory /Library/Tor/var/lib/tor sudo dscl . -create /Users/_tor Password '*' sudo dscl . -append /Groups/_tor GroupMembership _tor After that, there was still a little more to do to get Tor to run. I needed to create a place for the logs and fix the StartupItems script. Here's what I did for that... # Create the logs directory cd /var/log sudo mkdir tor sudo touch tor/tor.log sudo chown -R _tor:_tor tor # Fix perms on the "home" directory cd /Library/Tor/var/lib sudo chown -R _tor:_tor tor # In /Library/StartupItems/Tor/Tor change TORGROUP from TORGROUP=daemon to: TORGROUP=_tor # Start the Tor server sudo /Library/StartupItems/Tor/Tor start Cool. That fixed it. Thursday, September 13. 2007Software I Use
I often get people asking me what Mac software I use alot and if there's anything I can recommend to them. I recently put together a list of stuff I use at work (this doesn't include the *NIX stuff) for a colleague and figured others might benefit from it.
Wednesday, June 27. 2007TkCVS in Mac OS X X11
TkCVS (TkSVN) is one of the best tools I've found for visualizing CVS and Subversion branches. Since it is written in Tcl/Tk you can use it on Mac, Linux, and that other OS.
Here's how to install it on Mac for use in the X11 environment and how to integrate it with BBEdit. This assumes you have the X11 environment and BBEdit command line tools (bbedit and bbdiff) installed. Also, you should have a /usr/local directory and it has been added to your $PATH. You'll have to find out how to do this on your own if you don't already know how. Download the Unix distro (the latest was 8.0.4 as of this writing) to your Desktop.
Oh yeah. Don't forget that to cut/copy/paste (etc...) you need to use the control key and not the command key. You're in X-Windows after all. Monday, June 18. 2007Vana'diel Time
I recently started working on a Vana'diel (Final Fantasy XI) clock written in Cocoa. My reasoning for doing this (when there really isn't any need for another Vana'diel clock) is two-fold:
1. I want to learn Cocoa and a good way to learn something is to associate it with something you already enjoy (ie. Final Fantasy). 2. The only Mac OS X Vana'diel clock out there is old, lacks some info I'd like it to have, and doesn't really have the nicest interface (text only - no eye candy). The biggest hump for me so far was figuring out how to calculate the time. I looked at some javascript clocks people had written but I didn't like the fact that they all seem based on some arbitrary date. I wanted something that could go all the way back to the beginning of Vana'diel time. The Vana'diel epoch (the Vana'diel big bang, if you will). I decided, I wanted to write the algorithim myself, differently from all the ways I've seen it done. Fortunately, I found a great resource explaining some of the critical information needed to understand how Vana'diel time works. Thanks Miwarre! I wanted to rapidly prototype a simple clock to test my algorithm and I figured I could do it easily and quickly enough using Applescript. I've posted the script here for anyone else trying to work with Vana'diel time. When I re-wrote this for Cocoa, I didn't use the "seconds since epoch" constant I used here because I found a cleaner way with NSCalendarDate. The jist of it is that I can create an NSCalendarDate object using the "earth" date that corresponds to the Vana'diel epoch date and the effect is the same. I have to give a big special thanks to my girlfriend who checked my work (by hand!) and found that I'd originally used the wrong value in the unix_seconds_since_epoch_at_vana_epoch (it was missing the extra 86400 seconds for the 1968 leap year). This has since been corrected in this script. The Applescript simply returns the current Vana'diel date. set unix_seconds_since_epoch to do shell script "date \"+%s\"" set vana_rate_mod to 25 -- Vana time runs 25 times faster than earth time. set vana_seconds_per_day to 86400 set vana_days_per_week to 8 set vana_days_per_month to 30 --This value is derived from the amount of seconds that elapsed between the --Vana'diel epoch (0001/01/01 00:00) which is 1967/02/09 15:00 and the --UNIX epoch which is 1970/01/01 00:00. This includes a leap year (1968/02/29) --which adds an extra 86400 seconds. Since all calculations are based off seconds --since the UNIX epoch, we need to add this value to any UNIX seconds we use. set unix_seconds_since_epoch_at_vana_epoch to 91270800 -- Find out the Vana'diel minutes since the Vana'diel epoch. set vana_seconds_since_epoch to (unix_seconds_since_epoch + ¬ unix_seconds_since_epoch_at_vana_epoch) * vana_rate_mod set vana_days_since_epoch to ¬ (vana_seconds_since_epoch / vana_seconds_per_day) set vana_weeks_since_epoch to ¬ (vana_days_since_epoch / vana_days_per_week) set vana_months_since_epoch to ¬ (vana_days_since_epoch / vana_days_per_month) set v_year to round (vana_days_since_epoch / 360) rounding up set v_month to round ((vana_months_since_epoch) mod 12) rounding up set v_day to round (vana_days_since_epoch) mod 30 rounding up set v_hour to round ((vana_seconds_since_epoch mod ¬ vana_seconds_per_day) / 3600) rounding down set v_minute to round (((vana_seconds_since_epoch mod ¬ vana_seconds_per_day) mod 3600) / 60) rounding down if v_minute is less than 10 then set v_minute to "0" & v_minute end if set v_second to round (((vana_seconds_since_epoch mod ¬ vana_seconds_per_day) mod 3600) mod 60) rounding down if v_second is less than 10 then set v_second to "0" & v_second end if set v_wday to round (vana_days_since_epoch mod vana_days_per_week) rounding up set week_days to {"Firesday", "Earthsday", "Watersday", "Windsday", ¬ "Iceday", "Lightningsday", "Lightsday", "Darksday"} return (v_year & "/" & v_month & "/" & v_day & " " & ¬ v_hour & ":" & v_minute & ":" & v_second & " " & ¬ item (v_wday) of week_days) as string Sunday, April 8. 2007Download all Space.com Wallpapers
This is a really quick and dirty script I banged out in about a half-hour to download all the wallpapers at Space.com. I like reading the articles at Space.com from time to time and I found the wallpapers there are pretty cool. I wanted to grab them all and use them for my Mac OS X screensaver. Of course, downloading them individually (click, click, click, right-click, save as, etc... - ad infinitum), is a pain in the ass. So, the Space.com Wallpaper Download (sdcwd) script was born!
The script recursively downloads all the images of the specified size, creating folders for each collection. Just start it and let it run! I used the following software and versions, you'll need '-o' support in grep for sure and have curl and wget installed. Of course, if the urls change at Space.com, this script will be broken. Your mileage may vary. Software Versions: curl - curl 7.13.1 grep - grep (GNU grep) 2.5.1 wget - GNU Wget 1.8.2 #!/bin/bash # Space.com Wallpaper Download (sdcwd) image_size="1280" # Set this to 640, 800, 1024, or 1280 depending on the image size you want collections=(`curl -s http://www.space.com/php/multimedia/downloads/wallpapers/collection.php?collection=adrian_lark | \ grep -o 'option value="collection.php?collection=\(.*\)"' | \ sed 's,option value="collection.php?collection=\(.*\)",\1,'`) collection_url="http://www.space.com/php/multimedia/downloads/wallpapers/collection.php?collection=" image_url="http://a52.g.akamaitech.net/f/52/827/1d/www.space.com/entertainment/downloads/spaceart/images/" logFile="sdcwd.log" topDir="Space.com_Wallpapers" getImages() { this_collection="$1" collurl="${collection_url}${this_collection}" if [ ! -d "$this_collection" ]; then mkdir "$this_collection" cd "$this_collection" # Log echo "----------------------------" >> "../$logFile" echo "$this_collection" >> "../$logFile" echo "----------------------------" >> "../$logFile" curl -s "$collurl" | grep "/php/multimedia/imagedisplay/wallpaper_display.php?pic=.*_$image_size\.jpg" | \ grep -o "pic=\(.*.jpg\)" | \ sed "s,pic=,$image_url," | \ tee -a "../$logFile" | \ xargs wget -q # Log echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> "../$logFile" echo >> "../$logFile" cd ../ # If we didn't download any pics for this directory (maybe the requested size wasn't available) # remove the empty directory. find "$this_collection" -type d -empty | xargs rmdir fi } old_dir="`pwd`" mkdir "$topDir" cd "$topDir" for this_collection in ${collections[@]} do getImages "$this_collection" done cd "$old_dir" |
Syndicate This BlogRecent Entries
Archives |
|||||||||||||||||||||||||||||||||||||||||||||||||


