[Main] [Photos] [Resume]

Development: July 2008 Archives

Stupid Tricks: sleep_monitor

| | Comments (0)

Some of you know that I'm a hackintosh user. I've been an Apple fan for a long time, but nothing in their lineup currently works for what I want out of a machine. My last Apple machine was a black MacBook with the original Intel Core Duo. It went in for service three times, and finally, Apple just denied anything was wrong with it. I ended up selling that machine, and the hard drive that was originally in it died a week later.

Huh.

Right now, I use a Lenovo/IBM ThinkPad T61 14" Widescreen edition, with a Core 2 Duo at 2.2GHz, 2gb RAM, a 100gb drive, and DVD-RW DL drive. The screen resolution is a comfortable 1440x900, I have some wireless, and life is good. I'm also running OS X 10.5, licensed but violating EULA, because it's one of the greatest operating systems we currently have available. There are a few little issues with running Leopard on this machine. Most things work, but I don't currently have a driver for the built in ethernet, the machine won't sleep if I have bluetooth enabled, the machine won't wake up if I enable the PC card slots, I can't control the brightness of the LCD, and when the laptop runs out of battery, it shuts off instead of going to sleep.

There are a few people working on two of the issues, namely the brightness issue with the Intel X3100 graphics controller, and a driver for the Intel 82566M Gigabit Ethernet controller. No sense in duplicating their efforts. The only kext I've ever written was a small driver to enable the tablet serial port on the X61 tablet that I had before this, so people could use TabletMagic and get full tablet functionality in OS X. Ethernet driver creator, I am not.

But, hey, I give you one little turd to make your life easier, and you may even find it useful if you're on a real Mac. This little package, 'sleep_monitor', installs a LaunchDaemon and a binary on your machine to keep track of how much battery you have left and put your machine to sleep at a certain threshold. It's a simple idea, but most Mac authors would charge $20 for the privilege. I give you it for free, but you don't get a GUI. Sorry.

When you install the package, it immediately starts. It will wait until you have 4% of your battery remaining, and puts your machine to sleep. On my T61 with the 4 cell battery, that usually kicks me into sleep when I have about 5 minutes of use left in the menu bar, and that will give me many hours of sleep to find an outlet to charge things up. Want to change the threshold? Edit /Library/LaunchDaemons/com.abstractwankery.sleep_monitor.plist and change the second ProgramArgument to the percentage you'd like to kill out at. Have an 8 cell battery? 2-3% is fine. Have a nearly dead battery? Maybe 15% is more your thing. Leave the % sign out of it, it will only cause problems.

SleepMonitor 0.1
Mac OS X 10.4, 10.5

TwitterGrowl

| | Comments (2)

Why does Twitter suck?
This morning, my manager asked if I used Twitter at all. While I have an account, and I have a bunch of 'Friends' on there, my attention span for the service has never really lasted much longer than 2-3 days. Every time someone asks me about it, I grab a client or two, try things out, and realize yet again how many things really annoy me about the service. The top two were how much of a pain it was to post, and what a bigger pain it was to keep a feed going. The best I could find for OS X was Twitterrific, and it was just counterintuitive. The free version would put ads in, the 'auto reappear' never did, and it would just silently fail half the time and not post anything new for hours. Awesomesauce.

Granted, a few things have been fixed. The SMS posting service makes it really easy to actually post remotely, as none of the S60 clients are very good, and the Java clients really suck. They don't seem to be down as much, and the speed isn't terrible. Rumor has it, they're getting rid of Ruby on Rails, which just makes me jump with glee.

Since then, for posting, someone put together an AppleScript called Tweet, which allows you to easily post to Twitter through QuickSilver. It works well for me, I just hit Command-Space, hit period, type my tweet, tab, then tweet it. It sounds complicated, but it's really easy to deal with. I like it, and it was easy as hell to do.

Then, there's the feed problem. RSS is too slow, I don't want it cluttering up Google Reader. Twitterrific still isn't working for me, as pretty as it is. There are two Dashboard modules, and neither of them work well, and silently fail at that. What I really wanted was something that would just post tweets to Growl and be done with it. I found something, but it was a Ruby script with manual configuration and little extensibility. I didn't want to screw with it, so off to /dev/null it went.

Hey, there's a point.

In the end, I wrote a perl script called TwitterGrowl to do exactly what I want it to do. To make life easier, it relies on the Twitter login information in your keychain to log in, and prompts you to create one if it doesn't find anything. It reports when there's a login failure, or Twitter goes into Suckfest, or when a system maintenance issue is posted. Better yet, I packaged it up into an easy to use, double clickable application. Pop it into your Applications folder, drag it to your Login Items, and it'll go into the background and sign in when you log in. Easy as pie. All of the required modules are in the application package, and you can feel free to browse the source by viewing the package contents and heading into the Resources folder.

So, now that I have a steady "works for me", would anyone else like to give it a shot and see if anything breaks? Comment here with any issues or comments you find, and if no one posts, it either works great or I am a total failure. :)

TwitterGrowl 0.1 (Mac OS X 10.4 or 10.5, Universal)

Dytara

http://www.dytara.com
My little shell and holding company, currently under construction.

My Projects

Twitter Updates

    About this Archive

    This page is a archive of entries in the Development category from July 2008.

    Development: March 2008 is the previous archive.

    Development: September 2008 is the next archive.

    Find recent content on the main index or look in the archives to find all content.

    Pages

    Powered by Movable Type 4.21-en