Posts Tagged ‘Mac’

  1. Twitnews update

    Sometime back I posted an applescript to tweet news items in NetNewsWire to your twitter followers and seems like many people found it useful. I’m really glad that I could find some time today to make a few updates on the script.

    New features

    • Twitnews now saves your twitter login details to the keychain itself. The old script needed you to save your twitter login credentials to the system keychain manually. Now, it checks for the twitnews key in your keychain and if it does not exist, asks you for them and creates the key for you.
    • Growl support.
    • Checks character count is within 140 characters.
    • Uses URL shortener so that you can use analytics feature if you use it.

    I would however like to use Usable Keychain Scripting by Daniel Jalkut of Red Sweater Software, considering the problems faced by some users, which I blame Apple for their really bad implementation of Keychain Scripting. I tried using Daniel’s scripting definition but could not get it to work, probably it is not updated for Snow Leopard. I’m not sure about this, so if you have suggestions on how I can improve the script, please leave your comments.

    Please download it here.


    Unzip and drop it into ~/Library/Application Support/NetNewsWire/Scripts. Now you can access the script from the scripts menu on NetNewsWire.

    If you would like to assign a keyboard shortcut to the script, check this post.

    What else ?

    The script has been tested on 10.5 and 10.6, but still if you find it buggy, please let me know in the comments. Otherwise, I hope you find it useful.

    The code is available at Github.

    UPDATE: If you’d prefer to use URL shortener, the script has been updated by Sean to use for click tracking.

    UPDATE: has been shut down :( Please see this post for an updated script.

  2. Tumblr Dropzone

    Screen shot 2010-01-17 at 2.27.04 PM.png

    If anyone of you is using Dropzone app, I’ve made a small script to post images to the fun blogging platform – Tumblr. If you haven’t used Dropzone, it is a very useful mac app that lets you easily drag and drop files to perform customizable actions on them. For example, to upload the file to remote destinations, like your own FTP servers, Flickr, Posterous, Twitpic to name a few. But it is not just limited to file uploads, other uses include zipping and emailing the files you drop on it, install mac apps easily, share code on Github Gist or Pastie etc. Smoking Apples has a good review on the app.

    I mainly use it to quickly share screenshots I take while on work, and also to quickly share a file with someone else on my FTP server.

    The very good point with Dropzone is that the developers have made it very easy to extend the app with its API. If you are fine doing away with Ruby, then you can build your own destination scripts. I’ve just tried my hand on it, with a simple script that uploads the dropped image to Tumblr. I tried both the Net::HTTP method and also using Curl. However, using Curl seems to be quite faster.

    The code is at my fork of Aptonic’s user contributed scripts at Github.

    I believe that this app has got great potential and hope to see more extended scripts in the future and also will try creating my own if I get the time.

  3. Oniguruma on OS X Snow Leopard


    port install oniguruma5
    sudo gem install oniguruma -- --with-opt-dir=/opt/local

    (Via Pastie)

  4. TwitNews Keyboard Shortcut

    Some time ago, I wrote an applescript ‘TwitNews‘ for posting link to news items to Twitter from NetNewsWire. Many people seemed to find it useful and I’m happy about it. Today morning I got an email about how he used Spark app to create a keyboard shortcut to use the script. That is really useful because you dont have to select TwitNews from the scripts menu anymore. Instead just hit the assigned keyboard shortcut. That really gives it a native feeling. Unfortunately, I could not get Spark to work. Instead I found that it is much easier to use Mac OS X inbuilt feature in System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts.

    Just create a new keyboard shortcut with the Application as NetNewsWire, Menu title as ‘TwitNews’ if you haven’t renamed the script when you put it inside the scripts folder, and your desired keyboard shortcut. I chose ⌃T as it is the same shortcut with Safari140 which is a useful tool to post stuff to Twitter from Safari (if you didn’t know).

    Thanks to Ian Tornay for the idea of keyboard shortcuts!

  5. Tweaking terminal to enhance productivity

    Most of you who are familiar with UNIX systems are aware of this but for those who just migrated from Windows, you can create aliases in your bash profile to create shortcuts for commands you type into the Terminal every now and then. I have created a few of which I use often. Add these to your ~/.bash_profile or /etc/profile and restart your Terminal to bring them to effect.

    # System
    alias ll='ls -alh'

    # TextMate
    alias e='mate'

    # Subversion
    alias sup='svn update'
    alias sci='svn commit'
    alias sst='svn status'

    # Ruby on Rails
    alias ss='script/server'
    alias sgen='script/generate'

    Likewise you can create the same for the ones you use often.

  6. Autotest Rails with Growl

    Now, this is really cool stuff. Autotest is a part of the ZenTest package which helps you to run your tests in the background in your Terminal while you can continue writing your tests. Which means you don’t have to frequently visit your terminal just to fire away ‘rake’ to test your Rails application. Autotest runs them in each save to the test file you are working on. But unless you have a dual monitor setup, its going to be a bit of useless feeling because you may have to check whether the tests run OK. Thats where Growl comes !


    You can set Autotest to send the test results as growl notifications in Mac OS X. It is really cool if you set it up in the right way.

    First, if you don’t have autotest install it by running:

    sudo gem install ZenTest

    Now, you can hop into your Rails root and fire away autotest by:


    You can see the tests running, but it would be great if you could have some better feedback in the Terminal – like green for success and red for failure. This can be achieved through plugins in autotest. This is already installed when you install the gem but you just have to tell it to load them.

    Create a file named ‘.autotest’ in your home directory and enter the following:

    require 'autotest/redgreen'

    Start autotest and you should see some better feedback. Note that you need to press ^c twice to stop autotest because pressing ^c once, will reset autotest and run the whole test once again.

    Now lets get growl working. For this to work, you need to install ‘growlnotify’ which is a command line utility to send growl notifications. You can find growlnotify in the Growl disk image which you used to install growl (inside Extras). Note: I had to set a path to /usr/local/bin to get growlnotify to work.

    You can check whether grownotify is installed fine by issuing this command from the terminal:

    growlnotify -m "This should be growled !!!"

    To enable growl with autotest, insert the following in the .autotest file:

    require ‘autotest/redgreen’

    module Autotest::Growl
      def self.growl title, msg, img, pri=0, stick=""
        system “growlnotify -H localhost –image #{img} -p #{pri} -m #{msg.inspect} -t #{title} #{stick}”

      Autotest.add_hook :initialize do |at|
        growl “Autotest Started”, “Running…”, ‘~/Stuff/Growl_Icons/rails_ok.png

      Autotest.add_hook :ran_command do |at|
        output = at.results.last.slice(/(\d+).*errors/)
        if output =~ /ns.*[1-9]/
          growl “Test Results”, “#{output}”, ‘~/Stuff/Growl_Icons/rails_fail.png’, 2
          growl “Test Results”, “#{output}”, ‘~/Stuff/Growl_Icons/rails_ok.png’, -2


    You can grab the images used in the script from below and link to them appropriately. Also note that I have used priority of -2 for success and 2 for failure which means low and high priority respectively. You can set the background for these priorities in your growl preferences so that you get a much better feedback through growl (you can see mine above).

    rails_fail.png rails_ok.png

    Happy testing :)