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

29 May 2012

Tmux, a reluctant love story

Tmux…a complicated love story.

In the beginning it was like other romance, flirt a little bit, brief moments of interaction, maybe compile from scratch and smell the roses on distant servers.

But it never really stuck. GNU Screen was quite the workhorse and I only needed it on remote servers because Terminator terminal emulator worked very well with multi-splits and session state maintenance. I had many “Oh that’s what I’ve been doing” type moments. At the time I didn’t see any great benefit to it on a local box.

I gave it another try on my recent Arch laptop because all the cool kids seemed to have a revived interest in tmux. The controls were nice, the look was nice, but it had more funky scrolling and mouse selecting issues than Terminator… so back I went. (Note: I remember having to choose my configuration between either a functional copy and paste w/ mouse or functional copy and paste with keyboard…but this is loosely based on my distant memories).

Fast forward to last night when I received a reminder about tmux. I thought, there’s probably something I’m missing. Lo and behold, the thing I’m missing is the awesome power of Slime.vim, Pry, and Terminal or Gvim (MacVIM).

Slime.vim allows you to program in your editor, then highlight a block of code to execute, mash C-c C-c (very Emacs), and have the code run in another split window (powered by Tmux). For me the code composition happens in VIM and is piped into a Pry session for execution and exploration. I foresee many more Slime/Pry/VIM sessions in my future and am excited about the fluidity of this setup.

The long and short of how to get it working, install tmux, add vimrc command telling it use tmux rather than screen, highlight and C-c x2 for execution.

Seems like a perfect workflow and I’m happy that I explored more about tmux.

Next is xmonad…. here I come (on linux boxes).

28 May 2012

An Exercise: Contact Scraping or How to Get Hired with ZeroMail

I’m trying out ZeroMail and saw their job listing at zeromail.

Though I’m happily and gainfully employed, it looked like an interesting exercise. The challenge is (verbatim from website): (1) Download http://zeromail.com/static/download/emails.txt (2) Write a python program that extracts contact information from signatures in the emails (3) Send your solution to bart@zeromail.com or skype it to bartjellema

After an hour of tinkering with it on my own terms (my Ruby > my Python), I’m realizing it’s more complex than I initially expected.

I see it as a multipart process: (1) Strip junk characters and lines out of the data (2) Determine and locate signature blocks (3) Extract pertinent data from signature blocks (might resort to wordlists of given names)

I tried using easily identifiable information through regexes (ie looking for Australian and US format phone numbers). This yielded decent results on the numbers themselves and I’m considering using phone number’s (or email addresses’) line numbers as ‘hotspots’ that I can extract and further process.

If I spend more time on the process, I’ll post my results here.

27 May 2012

Todo.txt Count in RPrompt ZSH

I’ve been using Todo.txt for at least a year, both from the commandline and the Android app.

It’s great keeping a todo list in text files, synchronized across multiple devices via Dropbox, but there’s one nagging thing in my system.
That nagging issue is that Todo.txt doesn’t nag me enough about the issues in my todo list! So, I’m taking steps to resolve this by adding a function to my zshrc configuration.

I mapped out the basic command in the shell by combining todo’s ls, grep (to keep only lines starting with numbers), and then a wordcount by line.

The following function was taken from Wynnnetherland.com and modified since I installed todo.txt through Homebrew, and since I prefer a different command to count the items.

todo\_count(){ if $(which todo.sh &\> /dev/null) then num=$(echo $(todo.sh ls | grep "^[0-9]" | wc -l)) let todos=num if [$todos != 0] then echo "$todos" else echo "" fi else echo "" fi } function zle-line-init zle-keymap-select { RPS1="${${KEYMAP/vicmd/\>\>\> ○[$(todo\_count)]}/(main|viins)/± \<\<\<[$(todo\_count)]}" RPS2=$RPS1 zle reset-prompt }

The following is a diff of the difference showing the updated function [gist id=2817309]

Now my right hand prompt shows a nice count of incomplete todo items inside square brackets…like so: [gist id=2817339]

Update: My own syntax highlighting is escaping some of the characters, so here’s a gist of it [gist id=2817304]

24 May 2012

VIM Movement command of the Day

The movment letter of today for VIM is G Using ‘G’ moves to the end of the file (or more specifically to the final line of the file).

The complimentary command is ‘gg’, to jump to top of file!

VIM: The more I learn, the better it gets.

22 May 2012

Why I love Open-Source Software

Open-source software is wonderful. For example, I needed to batch convert 700 AutoCad files (DWG) into regular image files.

Step one: Find library to do this for me. Succeeded by finding cad2svg. Can’t run as its compiled in OSX, can’t recompile b/c it has unavailable proprietary blob. Read author’s blog & README. He states that it was developed in Red Hat Linux/ Fedora. Blog is dated ~ 2009.

Off I go to grab Fedora 12. Install in virtual machine, set up shared folder between host and vboxclient. Use script like find . -name \*.dwg -print0 | xargs -0 cad2svg - OUTPUT.svg

Then jump back into OSX to use a library from Cairo 2d image library, svg2png. This will convert them into png images.

Do some googling for correct imagemagick settings to invert the image, convert all non-white to black, and then convert to monochrome.

Spent a few minutes tweaking the settings, order of events, properly piping the output image from svg2png into imagemagick… and voila! Computer is currently chugging through all 700 conversions. Command to convert from svg to png (with tweaks) svg2png -w8000 '#{item}' | convert png:- -negate -fill black +opaque white 'svgs/#{output}.png' (Note: Piping these two commands saves writing temp file to hard drive) ImageMagic, svg2png, cad2svg (except proprietary blob) are great tools made even greater by their Unix philosophy (doing one thing well and using standard-in and stdout to chain together commands)

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.

20 May 2012

Useful VIM cheetsheet

New VIM command of the day: d/(searchterm) This will delete up until the search term.

Source of this wisdom: VIM Commands

20 May 2012

VIM Video by Bram

Watched this video today by the author of VIM: Bram MoolenaarVIM Video by Bram Moolenaar

It’s about 1.3 hours long and worth the watch.

A useful tip so far is the \*

Which uses your current word as a search term and incremental searches forward.