Saturday, April 26, 2008

Automatic paging with ack and rak (git style)

After reading Git-Style Automatic Paging in Ruby, I wanted to try it out on my new favorite command line toy: ack.

Getting ack to work is as simple as adding the following to your ~/.ackrc.

# Always color, even if piping to a filter
--color

# Use "less -r" as my pager
--pager=LESS=FSRX less -r

rak is very similar to ack, only written in Ruby. To see some examples of using rak, check out Getting to Know a Gem: Rak.

rak doesn't support paging by default, so I'd have to do a really quick hack to get things to work. Luckily, rak is hosted on git at git://git.donttreadonme.co.uk/rak, so I forked it over at GitHub and copied the run_pager method from the cheat project.

The results can be seen over at http://github.com/PotatoSalad/rak. I wanted to try out github's new gem building feature, so I included a gemspec file in my changes. If you've got rubygems installed, just run...

gem sources -a http://gems.github.com/ (you only need to run this once)
sudo gem install PotatoSalad-rak

(see gems.github.com for more information)

Finally, if you'd like to see my changes/make your own, grab a copy of my repository with git clone git://github.com/PotatoSalad/rak.git

Tuesday, July 31, 2007

Simple Gmail Phishing Filter

Gmail Screenshot with Spam (1337)After I noticed the tauntingly large number of messages sitting comfortably in my Spam folder the other day, I went about the routine of performing the "Delete all spam messages now" that many Gmail users are accustomed to. I then checked my inbox to find that 26 of my 32 unread e-mails were phishing attempts. Not bad, Gmail's spam filtering system managed to keep around 98% of the Spam out of my inbox, but the 2% of messages that continue to seep through all have one thing in common: YOUR EMAIL HAS WON!!! UK LOTTERY WINNER!!!

I seem to be very lucky in the United Kingdom, I win their lottery at least 7 times a day. Perhaps I'm living on the wrong side of the Atlantic Ocean. These "lottery" or "jackpot" phishing attempts are really the only type of message that consistently gets passed Gmail's filtering system, aside from the occasional Japanese or Russian one (I have no idea if they're phishing attempts, but I do recognize things like ¥5000000 and "SSN PLZ").

So, I came up with a so-far highly effective and simple filter solution that has been able to catch that remaining 2% that keeps slipping through:

  • Matches: (Lottery OR Jackpot OR UK OR "United Kingdom")
  • Do this: Skip Inbox, Apply label "Phishing"

Now all I have to do is take a quick glance at the messages labeled as "Phishing" and see if a valid e-mail accidentally got flagged by the filter.

Friday, June 15, 2007

I8kfanGUI for Mac OS X v0.2 with Dual Fan Support

I8kfanGUI IconThis is a very, very quick and dirty update to allow for secondary fan control. If your laptop only has one fan, there really is no reason to upgrade.

Please note that I have no way of testing if secondary fan support actually works, so please let me know if there are any problems with it. I'm basing it off of other code out there. I still need to clean up the code and allow for simple things like saving preferences and such. I may end up making this a system preferences panel.

So, without further delay, grab the new release from the I8kfan project downloads page, or from right here:

Note: I mentioned this in my last post, but older model laptops (Inspiron 1100, 5100, etc.) or any model that does not have Enhanced SpeedStep (CPU flag EST) still require AppleIntelCPUPowerManagement.kext. Many sites recommend deleting this file, but your older laptop's temperature will skyrocket from 35°C to 65°C.

Developers: You can also grab the source from the I8kfan project subversion repository: