You can run Swift code from the command line?

0

Posted by Jaime | Posted in Coding | Posted on 23-12-2014

Tags: , , ,

WAT? Now this is something else! practicalswift.com

Finding the “file in use” culprit in Mac OS X

0

Posted by Jaime | Posted in Tip | Posted on 28-09-2012

Tags: ,

Thank to a tip at MacWorld, I was able to find out what process was locking a file I wanted to delete.

lsof | grep [whatever]

List open files

0

Posted by Jaime | Posted in Tip | Posted on 28-09-2011

Tags: , , ,

On the Mac OS, if you need to know what files are open and by what application and on what disk, you can use the lsof command in Terminal.

Pair that command with grep and you can isolate things like this:

lsof | grep "Snow Leopard"

This will show you what files are open that have “Snow Leopard” in the name.

Running AppleScript commands from the Terminal.app

1

Posted by Jaime | Posted in Coding, Tip | Posted on 30-06-2011

Tags: , ,

I found some pages on the web on how to run an AppleScript from the terminal, but this seems to be the only one that works in my situation:

?View Code APPLESCRIPT
echo 'tell application "Google Chrome" to quit' | /usr/bin/osascript

In my case, my keyboard stopped working so I wanted to safely shut down the programs via ssh before I rebooted the workstation.

Getting rid of build directories

2

Posted by Jaime | Posted in Coding | Posted on 11-05-2011

Tags: , ,

I wanted to get rid of the “build” directories in my source folders before prepping my source folders for git, so I used the following command to get rid of them:

find . -iname "build" -type d -print -execdir rm -R '{}' \;

Recursively deleting folders

0

Posted by Jaime | Posted in Coding | Posted on 26-04-2008

Tags: , , , , ,

While I was looking at my backup log in Retrospect, I saw an error message about a directory had more than 100 folders deep. What?

I took a look and sure enough, Entourage had gone on a folder making frenzy and had created well over 100 folders within each other:

My Project.rge/My Project.rge/My Project.rge/My Project.rge/My Project.rge…

Well, I fired up terminal.app, typed rm -R and expected my problem folder to go away. But it didn’t. The folders that Entourage created were actually bundles, so now I had to dig a little deeper:

find . -iname “*.rge” -exec rm -rdf {} \;

Basically, this calls the find command recursively on every bundle found with the “rge” extention and deletes it. So if anyone else out there has the need to recursively delete bundles/folders on their Mac OS computer, just type in the above command… with extreme caution 🙁