|
Mac GeekeryGet your geek on. |
31d1's blogIf you have an Apple laptop with Airport this bash line returns the SSID of the current network: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk '/ SSID/ {printf $2}'With that in mind i made a smart homepage script in php. I run it on the built in webserver and use it as my homepage. Given a list of trusted SSID’s it will test internet connection and: 1. if connected to a trusted network it will load homepage if connected or display an error if not connected 2. if connected to another network it will display SSID and connection status 3. if not connected to a wireless network, show homepage if internet detected (like ethernet or whatever) else display an offline pageThere's more » Just a tiny little one-liner I came up with that I thought I’d share. It works great with GeekTool. cal | sed "s/^/ /;s/$/ /;s/ $(date +%d) / $(date +%d | sed 's/./#/g') /" It displays the regular unix calendar, but with the current date replaced by #‘s. Like this:
December 2005
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 ## 20 21 22 23 24
25 26 27 28 29 30 31
Nothing big, and I’m sure you already knew how to do this, but you never know A recent hint at macoshints shows how to create a shell script that will make all the Applications on your system available with tab completion. I’ve gotten used to Quicksilver and was interested in how this replicates some of that idea in the shell. But when I started looking through the comments there were some subleties and it got a bit complicated. I started poking around thinking of how I wanted to get this going and ended up finding something rather nice. Apparently, programmable completion has been around in bash for a while (via the shell builtin complete), but it needs to be scripted. However, there are some powerful scripts/packages floating around to demonstrate it’s capabilities. I like fink, and sure enough, fink has a bash-completion package. Here’s what I had to do to get it working:There's more » Macs have quite a few hardware and temperature sensors, but the only CLI option I’d run across is the tool that comes with Temperature Monitor.app, which is a binary. I was thinking that you’d have to use some sort of frameworks and compiled Obj-C to access these readouts, but while mucking around in the guts of my machine trying to write a system monitoring script, I noticed that the information is available deep within ioreg, apparently undocumented and slightly hidden (all the numbers are multiplied by 65536). Update: See comments, this may not be that accurate at all. So I was able to write a script that displays all the hardware sensor readouts of my machine. It turns out that all the different macs have different sensors and the formatting in ioreg can also vary, but after getting some dumps from friends with different macs, and visiting an Apple Store and looking in the guts of a few of them, I was able to make a script that should return all the hardware sensor values (if any — the mac mini seems to have none) of any recent mac, without having to write a special case for each one.There's more » So there’s a Tiger compatible version of GeekTool floating around finally, and I’ve been playing around with it the past couple days. I’m still a beginner at shell scripting and the whole gestalt of modern computing, and I’ve found this not only fun to play with, but also quite educational, especially with regards to those geekiest of tools, bash one-liners. I’ve learned a lot from this, for instance that I like |
|
||||