December 03

Shell Fun - The switch to ZSH

So I recently switched to zsh after encouragement from a friend and wanted to share some of the possible benefits. With some help I was able to bring over some history improvements I had in bash to zsh too.

I was pointed to this blog entry that pretty much sums up some of the pros of using zsh over bash. I'm a big fan of the tab completion options available along with the auto-correction. I can do "cd public" in my home folder and it'll fix it to "cd Public".

Tab completion

The tab-completion is able to do a fancy menu selection too which I kind of like: terminal-zsh-tab1.png

You can move the selection around the arrows or control-C to cancel out. In this case I didn't type any characters yet, "GarageBand/" is the possible selection. Hitting enter will confirm. It behaves a bit different but I'm liking it.

History

One thing I did like which I didn't have setup at first was the prefix history search. The idea is you type in something like "ssh" and then can cycle through your history for anything starting with that. This makes it easy to find a previous ssh connection in this example. You can bind this behavior to a key, which I would bind to the typical history cycling of up & down. The bash history blog I linked to above mentioned this in the comments and required putting it in .inputrc. With zshrc it turns out I just needed to use it's format within zshrc itself:

bindkey "\e[B" history-beginning-search-forward
bindkey "\e[A" history-beginning-search-backward

This differed from bash's commands by the -beginning- piece being added here, otherwise it uses the previous word you typed only I believe.

My zshrc

There's a ton of stuff to learn about zsh of course, and I don't understand half of what's in my zshrc either. But I like the benefits and hopefully will slowly learn more. What I did to start is just tweak an existing one so I'll provide mine here:

My zshrc

Things it has: * A list of your servers * shortcuts to push it to the listed servers * some shortcuts to setup git for a project, including the remote copy * shortcut for cloning from my GITSERVER * tons of other useful shell functions * Sets up ls to colorize listings on linux & OS X

The zshrc is based on what Nicholas Penree gave me and thanks to him for helping improve my terminal using experience! Be sure to check the top of the file for the areas to customize.

Todo

There's some things I have yet to figure out too. Some things I'd like to figure out:

  • Detect OS X GUI access to set $EDITOR properly (mate -w only if we can open a GUI app)
  • Track changes to zshrc through git instead of just get/pushing it randomly
  • On my MBP control-A and E don't do beginning/end line like they normally do, weird!
  • Actually organize things a lot better, bindkeys are everywhere, so are various functions
07:33 PM | Tags: ,
November 01

PHP Script Logger

I forgot about my old script logger and I didn't bring the page over from my old blog, it's a nice little web app. I made it to log various errors and problems to an sqlite database. You can see common errors, where they happened, etc. It's a bit old, but maybe someday I'll update it, though I think it'd be best if a php extension was made for it for the actual error capturing.

PHP Script Logger Page

11:55 AM | Tags:
October 12

Tweetie 2.0 Custom URL Shortening

Tweetie 2.0 for iPhone came out recently and has a nice feature for specifying your own URL shortening service, like one that uses ButteredURLs. It's easy enough, might want to email yourself the API key from your install of ButteredURLs or visit it on the device. Then you can copy & paste it into the "Custom" option for URL shortening services in Tweetie's settings. You can view the API key when you're at the admin area.

The URL should look a little like this, replacing APIKEY with your own key:

http://example.com/-/?api=APIKEY&url=%@

Tweetie will replace %@ with the URL it's shortening. For more details on the custom shortening feature of Tweetie 2.0, see the developer page about it.

Also check out Tweetie 2 itself.

07:23 PM | Tags: ,
September 14

ButteredURLs Updated

I just recently did some small updates to ButterdURLs which adds some features from the recently updated Lessn software from Shaun Inman.

1.1.1 Changes:

  • Fix for issues #1 (shortening your own short URLs by accident)
  • Support for api and redirect URL arguments thanks to Lessn 1.0.5
  • Added new configuration option HOMEPAGE_URL for redirecting somewhere if no short url is given, i.e. my site I'll set to http://jeremyknope.com/

Also available recently is a OS X service for either Lessn or ButteredURLs thanks to Steve Streza:

Download

Source

11:43 PM | Tags:
September 10

OS X Screenshots location

This isn't really anything new but I finally changed my system's default location for screenshot storage. The desktop is a gross place for them to go, so much clutter! Someone pointed me at Blacktree's secrets which got me the preference I was looking for. They have a prefpane but it's not 64-bit for 10.6 yet, relaunching System Preferences is gross.

Manually setting it in terminal:

defaults write com.apple.screencapture location "~/Pictures/Screenshots"

Once that's set you have to logout to have it take affect as I was impatient first time and thought it didn't work.

This was also an excuse to write a quick blog post since I want to try to get myself to blog a bit more. Woohoo.

06:12 PM | Tags: ,
Next → Page 1 of 2