Follow onomatopej on Twitter Blog Projects Publications Contact About

Opening specified path in Terminal’s new tab

March 24th, 2009

Updates

  1. It uses now click menu instead of keystroke “System Events” command, because in some cases when you had this script assigned to shortcut that used Ctrl or Shift modifiers, those modifiers were sent together with Cmd to “Terminal” producing invalid behavior.
  2. It waits 0.5 second when window is busy just in case Terminal.app was not running and it is just loading the shell which makes it busy for short while too. Fixes incorrect behavior of opening extra tab when Terminal.app was not running.

If you ever wondered how to open specified path in new tab of Terminal.app or reuse current one if it is not busy (running a command), here’s a script you may use:

tell application "Terminal"

    activate

    set windowCount to (count of the windows)

    -- Terminal may be just launched loading the shell, wait a bit
    if windowCount is greater than 0 and first window is busy then
        delay 0.5
    end

    -- Still busy / no windows? open new tab
    if windowCount is greater than 0 and first window is busy or windowCount is 0 then
        tell application "System Events" to tell process "Terminal"
            click first menu item of first menu of second menu item of first menu of third menu bar item of first menu bar
        end tell
    end if

    do script "cd #{e_as(e_sh(dir))}" in first window

end tell

Where #{e_as(e_sh(dir))} is your desired folder. This is modified chunk of TextMate‘s command script found at Mark Eli Kalderon’s Blog. Thanks Mark!

Note: Mark’s TextMate command script does not open anything when Terminal.app has no windows or it is not running.

Back from ITSBA OpenCoffee

March 19th, 2009

Today I have paid a visit at OpenCoffee organized by IT Small Business Alliance at Filmowa Cafe (just inside Kino Kijów). That wasn’t big effort for me since I am just living about 15mins by walk from there. I was surprised to meet many great folks involved in Kraków’s local IT business and some representatives of broader companies/organizations like Cisco and TechCrunch.

I am running my own business for 3 years now, however last 2.5 years I was working actually for just 3 clients that were keeping me alive, most of them were foreign companies. So I wasn’t particularly interested what is going on in Kraków where I am living for past 10 years. Since lately one of my major clients is going to shut down his business I decided to try myself at the local market – as so called “freelancer” seeking for the projects.

I must confess it does happen a lot in Kraków nowadays. Wow… I am pretty happy I have chosen to stay in such a great city. Keeping my finger crossed for Mike Butcher having TechCrunch conference done here in Kraków.

I use this!

March 19th, 2009

MinGW on Mac, hell yeah!

March 19th, 2009

GCC LogoWant to build some small/or not, neat Windows/or Linux application on your Mac? Just use MinGW/Linux GCC cross compiler package from Pierre Molinaro. Those were recently updated to GCC 4.2 and do cross-compile really fast, especially when using make -j2.

It is hard to be Switcher and totally forget/abandon Windows projects, since most of my clients… well almost all of them are on *indows. So since I switched, I am constant user of VMWare Fusion + XP (Win7, Win98) as a guest OS having Visual Studio installed inside. But sometimes if you want to create small cute application for *indows I prefer do it 100% on Mac with TextMate, then just test it on Windows. This is what MinGW cross compiler is perfect for. Not to mention I did Miranda’s MinGW Makefile that successfully builds miranda on Linux/Mac using cross-compiler, so it can be queued for nightly builds on SF.net servers.

No more free lunch, maybe a pie for free?

March 12th, 2009

How to survive computing paradigm shift

We cannot count on free “performance lunch” anymore, but how about at least a pie for free? Do we need to throw all our old source-code into the trash bin and start over again? 

Certainly, not. We may think of our old software as a zombie of the new multi-core era. Still there is a way to make the zombie walk, even walk faster. Of course we will need to rewrite our code sometime, but we may postpone this nasty need for a while. 

The computing paradigm shift is now a fact we need to learn how to live with. It is unquestionable that processor manufacturers hit the barrier of 3 GHz. There pretty many news about spinning the CPU up to 5 GHz or so, but do not try to do so at home unless you got liquid nitrogen cylinder around. Over 3 GHz heat emission grows unreasonably making the CPU economically worthwhile. 

So the only sensible way is now horizontal performance improvement, doubling the number of processing units. This means we can expect soon 128 core CPUs. Oh, wait they are here already; nVidia GeForce 9 series are perfect example of 128 core streaming processor. 

Now how to keep up with things that happen so fast. First we need focus more on performance of our code. Something that was not important before, now cannot be ignored.
Read the rest of this entry »