Squirt: Follow Me On Twitter

Twitter Stream

I used wordle.net to generate a tag cloud of my twitstream so you can see the kind of stuff I’m blabbering about on Twitter. I’m usually complaining about something or another – The “All Mail” Gmail folder in Mail.app, Frustration with Kindle for iPhone, The App Store – but sometimes I tweet some useful junk like blog announcements or problem fixes.

So follow me!

I’m working on a couple interesting posts here so don’t write me off just yet. You can also subscribe to this blog to get updates.

SSH Login Without Password

This is the old public/private SSH key switcharoo that allows clients to log into servers without being challenged by a password. This is one of the least secure of the SSH setups, but still beats ftp security by a long run. Here are the steps:

  1. Make sure you have added the RSA key fingerprint of the server to the client’s “known_hosts” file. This is as easy as attempting to ssh to the server and answering YES to the dialogue. The key will then automatically be registered to the “~/.ssh/known_hosts” file. You don’t even need to successfully SSH to the server at this point to get the key registered. This step can actually be avoided as you will register the key in step 3 when you scp.
  2. Generate the client’s SSH key. Just type
    # ssh-keygen -t rsa

    at the prompt (you want an RSA key type), then just hit enter to accept defaults for everything, including leaving the passphrase empty.

  3. Move the client’s public key – “~/.ssh/id_rsa.pub” to the server. You can do something like this
    # scp ~/.ssh/id_rsa.pub hostname:/Users/clatko/

    Where you put the key on the server at this point is irrelevant.

  4. Add the client’s public key to the server user’s “authorized_keys” file. On the server you can “cat” this key to the existing file by doing
    #cat id_rsa.pub >> .ssh/authorized_keys

    Also, you can add keys across users if you want, but this opens up the ability for abuse (adding a regular users key to root’s authorized_keys file, etc.).

That should do it. If this doesn’t work, you probably have a permissions problem somewhere – SSH is very picky if the wrong permissions exist on the .ssh directory or its contents. .ssh needs 700 and authorized_keys needs 400 (at the very most).

Beetle Labs

Beetle Labs

I’ve decided to create an application launch platform called Beetle Labs. The purpose is to have a public staging area where I can get feedback on different ideas. Whatever gains traction, I’ll spin off into a separate site with a new UX. Most of the stuff I put out there, I expect to fail. Failing applications just won’t receive the attention that more prominent ones do. It’ll be a sort of survival of the fittest. The first app probably won’t launch for another week or so, but I’ll announce it at that time.

Squirt: Moving Files Around Using Bash

I needed to copy all files with the string “_1” in them to a separate folder and remove the “_1”. I thought I could pull this with a one liner, but that wasn’t happening. A two liner had to do:

# find . -name "*_1.jpg" -exec cp {} ../xx/ \;
# for file in *_1.jpg; do mv $file "$(basename $file _1.jpg).jpg"; done

A brief explanation of the above.

I usually use find/xargs quite a bit, such as removing .svn directories when I forget to export. This wouldn’t work in this situation, because I needed to use the result of the find as an argument within my next command and the pipe wouldn’t do. So the -exec flag of find will pass the match as an argument that can be used with the syntax {}. The semi-colon denotes the end of the command and I’m escaping it with a backslash. So this reads “find all files in the current directory that end in _1.jpg and move them to ../xx/.”

The second command I ran within the “xx” directory. The basename string manipulation let me strip the _1.jpg from the name, then I re-added .jpg and this is all within the quotes so it comes out as a single file name. So this reads “for every file in this directory that ends in *_1.jpg, rename by removing _1.jpg then adding .jpg to the end.”

I guess this could have been done in one line, but whatever.

Squirt: Finding Hidden Preferences in OS X Applications

When Safari 4 Public Beta came out, there was a mad rush to find the applications hidden preferences. Some used it to bring back the aqua loading bar, others used it to bring back tabs on bottom, and others were just curious. I’m leaving S4PB the way it is because I want to give it a chance to win me over. Here are three ways that I know of to find these hidden preferences.

  1. Right click (control-click) on an application and select “Show Package Contents” from the popup. Open up the Info.plist and see if there is anything interesting to change. Also, it’s fun to poke around the Resources folder, there are all kinds of neato icons and other goodies.
  2. Find all the strings in the application binary. From the command line, run this “# strings /Applications/Safari.app/Contents/MacOS/Safari”. You have to target the binary file and “Safari.app” is just a package (a glorified folder). You’ll get back a bunch of junk, but if you look closely there are gems in there like “IncludeDebugMenu” which you can modify with the “defaults” utility. If you want to turn on the debug menu, you would do “# defaults write com.apple.Safari IncludeDebugMenu -bool YES”, restart Safari and you’ll see the debug menu.
  3. Read the defaults. So run “# defaults read com.apple.Safari” and you’ll get back a bunch of preferences. You can change these by using write or delete. Check out “# man defaults” for all the info.

If you know of other ways, I’d love to hear about them.