31 Jul 2012

FASD - The Commandline Shortcuts I always wanted

FASD is a shell script that follows in the concept and footsteps of Autojump and Z. It extends the functionality of both of those systems to better differentiate between files and directories. FASD also allows for tacking on different commands to the beginning of a fasd reference such as using vim in an alias, ie: alias v='fasd -e vim'. This VIM alias calls up the most active file matching that pattern and opens it in Vim. Or a simple z searchterm will find the most often and recently used folder and ‘cd’ into it! This is amazing for nested folders. It’s like Vim’s Ctrl-P or Ctrl-T but on the commandline and with more flexibility.

It’s magic and I’ll post back if I keep having good success. Try it out with a brew install fasd or check the install instructions on their github page for more options - FASD.

Update: Still having very good success.  Moving from ~/ to deeply nested folders is a breeze with ‘z SOMEPARTOFPATH’ and likewise using vim to edit a deeply nested file with ‘v SOMEPARTOFNAME’.  It’s nothing short of magical after 2 months of use.

Update Jan 2013: Can’t imagine living in the shell without FASD. This is now included in my environmental setup script.

19 Jul 2012

X11 Forwarding: Or How to use my favorite Calculator in OSX

I switched to a Macbook Air a few months ago and I’ve been generally quite happy with the setup.

One thing I’m unhappy with is the availability of my two favorite calculator programs. On Linux distos I’m accustomed to installing ‘qalculate’ and on Windows it’s been GraphCalc. I tried to find equivalent programs under OSX, giving it all of 15 min of effort, but couldn’t find a robust solution with good history, nice data entry, etc.

So, I decided to stick with my favorite (‘Qalculate’). I then tried installing it from source under OSX which didn’t succeed. I then tried to do the same with graphcalc’s Linux source, with the same result.

At this point I remembered toying around with X-forwarding over SSH. Since I had already installed the X11 environment for running GIMP (GNU Image Manipulation Program), it was trivial to que up a virtual instance of Debian Linux under Parallels. I installed Qalculate in that virtual instance and used the ssh command for X-forwarding: ssh -X username@server\_name 'qalculate-gtk &'

The result is that I have a virtual instance of Debian running in the background, my normal OSX interface, and my favorite calculate ready to go (as if it were a native OSX application).

Thanks SSH!

05 Jul 2012

Linux Command of the Day

No fancy commands today, just good ol’ functional admin action. I was setting up a couple of new Virtual Private Servers (ala EC2 or DamnVPS) and came across the following helpful command ssh-copy-id -i ~/.ssh/id\_rsa.pub username@remote\_server\_ip\_or\_domain What it does is copies (appends) your ssh key to the list of permissible keys on the remote server.

Need to make an SSH key for this purpose? ssh-keygen -t rsa -b 4096

Need to install ssh-copy-id on OSX? brew install ssh-copy-id

25 Jun 2012

Parallels - Your Ads belong in Trial Versions

Dear Parallels Team,

It’s unacceptable to put ads in a product for which I paid full price (ie Parallels Desktop 7).

Thanks to Google and someone in the Parallels forum for mentioning that the answer is here: NetizenSmith.org.uk. This is a much more palattable place to learn about it compared to needing a Private Message on the Parallels Forum.

Credit to Netizen for finding out that you can type the following in the terminal to remove their ads: defaults write com.parallels.Parallels Desktop ProductPromo.ForcePromoOff -bool YES

21 May 2012

5 Days of OSX

Well, it’s been 5 days since getting an OSX laptop (MBA) and it’s treating me pretty well.

Here are some initial impressions: Some of the coolest things: 1. Spotlight 2. Quicksilver (launcher app) 3. Quickcursor (vim geek app lets edit with vim everywhere… like this an email or blog post) Thanks to Conner’s Blog4. Touchpad is magnificent… crazy amount of multitouch gestures 5. System based on BSD Mach kernel… allowing all sorts of Unix-compliant goodness Along with that goes MacVim, iTerm2, growl, and all my unix commandline favs 6. Homebrew and MacPorts… both very good but not as well integrated as Debian’s apt-get and Arch’s pacman. Oh well, still waiting for slick Linux laptop with the hardware support of OSX…(not holding my breath)

What’s not so cool: 1. Learning new keyboard shortcuts 2. Fn key is a complete waste of space, need to remap it to be Ctrl (Did this with KeyReMap4Macbook: Note that the config can be tricky depending on other keyboard tweaks, but it’s now working) 3. Logitech mouse is a bit tweakier than under Linux & windows. (Update: MagicMouse looks pretty cool, esp with multitouchtool) 4. Terminal based VIM is SegFaulting with one of my addons (it allows me to blog from commandline for blog.xargs.io, my tech blog. Thankfully it works ok in MacVIM). Haven’t solved this yet but with it working for 99% of my tasks… the troubleshooting can wait for a rainy day. Maybe updating Mac’s pre-installed python…and recompiling VIM.

21 May 2012

Using ZSH's History Incremental Search with Vi-Mode

I switched to ZSH a few months back and am spending more and more time in commandline + VIM/MacVIM.

Once I added the tag to my dotfile to force vi-mode on the commandline I lost the ability to do incremental searches of my zsh history. So here’s the fix which saves lots of typing:

First, the regular keybind to allow Ctrl-R to enter history search backward mode: bindkey "^R" history-incremental-search-backward

To fix the fact that the prior keymap no longer works in vi-mode zsh, add this to a zsh config: bindkey -M viins '^R' history-incremental-search-backward bindkey -M vicmd '^R' history-incremental-search-backward

Now I can ^R with aplomb…

This is thanks to the explanation from JDeBP over on superuser.com.