KRL Commit Growl Notification
I have been using the Kynetx KRL command line tool for several weeks now and it has made my development of Kynetx apps much easier. The only problem that I have had as I have been using the command line tool is that once I commit my app I have to wait a few seconds before being able to run the new version in my browser. Until now I have been doing a lot of command + tab switching between windows to check to see if it has finished saving.
I have now created a clean solution that allows me to know when the version has finished being committed to the Kynetx servers and had one unexpected benefit.
I started out by creating a simple bash alias that would pipe the output from the ‘krl commit’ command to a growl notification
# Growl notify after krl commit is done
alias krlc="krl commit | growlnotify -t "KRL" --image /Users/mikegrace/src/kynetx-x.png;"
I quickly realized that this wouldn’t work for me because piping the console to the growl notification means that the commit output wouldn’t be visible on the console. I need to be able to see on the console what the output was in case there were errors or the latest saved version so I started looking for a better solution and came up with this
# Use growlnotify to alert user of commit status
if [[ $@ == "commit" ]]; then
command krl commit | tee status.txt | growlnotify -t "KRL" --image /kynetx-x.png;
command krl $@
I created a function in my bash profile that runs when I run the krl command. When it sees me using the commit parameter it will do a krl commit and then tee that output to a status.txt file and pipe it to the growl notification. To have the output also show up on the console I cat the status.txt file back to the console. The unforeseen benefit here is that it is now really easy to share error output with others because it can be found in the status.txt file in the app folder.
I also created a bash script, available on my github, that takes care of the installation for you. I created this script purely for fun and I had a blast doing it!
I had a really great time doing all of this and learned a lot. There is a lot of power in being able to manipulate command line tools to make tasks easier.
As Bigweld would say, “See a need, fill a need”
What is key based authentication for ssh?
Key based authentication for SSH is a way to connect remotely to another computer/server using an encrypted file you HAVE and an optional password you KNOW to unlock the file. Key based authentication has the advantage of being more secure and/or more convenient.
Password based authentication:
Logging in via password over SSH encrypts your password so it ends up looking like this:
Because the password is encrypted, it won’t be seen in plain text over the wire which is good. If the password is short or simple enough, a hacker will be able to crack your password. Assuming the password is good enough, password based authentication’s strength comes from keeping that knowledge from others.
Key based authentication allows you to connect remotely using an encrypted file as a key instead of a password. Key based authentication gives you the option to continue reading the rest of the article…
Terminal loves Finder
In Mac OS X Terminal open the current folder in Finder by using the command ‘open .’ You can also open a file with its default application by using ‘open fileName.fileExtension’
If the current working directory in terminal is “/System/Library” then ‘open .’ would open “/System/Library” in finder.
‘open test.txt’ would open the text file “test.txt” in TextEdit.
‘open *’ would open all the files in the current directory with their default applications.
‘open *.jpg’ opens all jpg images in folder.
‘open [ABC]*.pdf’ opens all pdfs that start with an uppercase A, B, or C.
The possibilities and the power of the ‘open’ command in terminal are astounding. Learn even more about the command by using the command ‘man open’ or just ‘open’ and the terminal will display more information on that command and how it is used. If you use the ‘man open’ command spacebar will show the next page and ‘q’ will exit the manual.
The heart in the image was acquired from http://www.eyehook.com/free/love.html under the Creative Commons Attribution 2.5 Generic License
URL: http://www.eyehook.com/free/love.html Accessed: 2009-4-24. (Archived by WebCite® at http://www.webcitation.org/5h1DQldAm)
Open files or directory in Finder from OS X Terminal by Mike Grace is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
Executing binary file in terminal fails returning “Can’t execute binary file”.
In terminal enter “chmod +x [filename]“
chmod +x adds the permission for the user to execute the binary file.
chmod. Wikipedia. URL:http://en.wikipedia.org/wiki/Chmod. Accessed: 2009-04-10. (Archived by WebCite® at http://www.webcitation.org/5fvIhQ3Zg)