Howto: Ricing Mac OS-X with Zsh, Iterm2 Borderless + Padding, TMux and KWM

This past weekend I saw over on /r/unixporn that ricing Mac OSX is a ‘thing’. I used to have a lot of fun doing this on my old linux systems when I was a kid, like Enlightenment, Afterstep, Windowmaker, XFCE, and anything else I could customize to look like something from a cool ‘hacker movie’ or something like that.

Anyway, this got me inspired to change my desktop into something a little cooler looking than standard OSX and here’s the basic premise of everything I did.

First, you’re going to want to install Brew, which is a package management system that’ll let you install additional software on your mac in a nicely controlled and updatable manner.

/usr/bin/ruby -e "$(curl -fsSL"

Now that brew is installed, we can run through the rest of the basic setup to get this going.

What I did first, was change the default shell from Bash over to Zsh, which you can see the differences here if you’re interested

 brew install zsh
 nano /etc/shells
 sudo dscl . -create /Users/<YOURUSERNAME> UserShell /usr/local/bin/zsh
 sudo dscl . -create /Users/hugodrax UserShell /usr/local/bin/zsh

now check to make sure it’s set properly

 dscl . -read /Users/$USER UserShell
 echo $SHELL

copy this in to your .zshrc

 setopt notify
 bindkey -e
 zstyle :compinstall filename '/Users/hugodrax/.zshrc'
 autoload -Uz compinit
 autoload -U colors && colors
 PS1="%{$fg[cyan]%}%n%{$reset_color%} %{$fg[white]%}%~ %{$reset_color%}%% "
 alias ls='ls -G'

Now, let’s install instantly awesome Zsh

 cd ~/Documents/Source/
 git clone --recursive "${ZDOTDIR:-$HOME}/.zprezto"
 for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^; do
 ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"

then, lets change the prompt

 prompt -l
 prompt -p kylewest
 prompt kylewest

then make it permanant

 nano ~/.zpreztorc

and change

 zstyle ':prezto:module:prompt' theme 'sorin'


 zstyle ':prezto:module:prompt' theme 'kylewest'

also, scroll to the second to last line and uncomment the iterm2 integration in the same file, then exit and save. Now, you should be able to start up Iterm2 and you’re running Zsh in there instead of bash.

Now, lets install tmux, a wonderful GNU Screen replacement

git clone ~/.tmux
ln -s ~/.tmux/.tmux.conf ~/.tmux.conf
cd ~/.tmux
git submodule init
git submodule update
cd ~/.tmux/vendor/tmux-mem-cpu-load
cmake .
sudo make install
cd ~
git clone fonts
cd ~/fonts 
pip install --user powerline-status
cd ..
git clone pld
cd ~/pld 
gcc -O3 powerline-client.c -o powerline-client
chmod +x powerline-daemon
sudo cp powerline-client powerline-daemon /usr/local/bin
sudo apt-get install powerline
then add this to tmux.conf
nano ~/.tmux.conf

if-shell 'test -f ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' 'source-file ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'
Then change your font in ITerm2 to be a -powerline font and all should look nice.

So, next we’re going to want to install a customized version of Iterm2 to accommodating padding , and borderless which looks much cooler 🙂

So in our terminal we’ll go

 cd ~/Documents/
 mkdir Source && cd Source
 git clone iterm2-borderless-padding
 cd iterm2-borderless-padding
 ./ 20 20
 mv ./iTerm2/build/Development/ /Applications/

Now, re-open Iterm2 and you’ll have a zsh shell with colorized ls output, running in a borderless window with 20 pixels padding on all edges. Don’t forget to change your font to one of the -powerline fonts, and try out tmux too!

Then, we’ll install KWM which is a nice tiling window manager.

 brew install koekeishiya/kwm/kwm
 mkdir -p ~/.kwm
 cp /usr/local/Cellar/kwm/3.0.7/kwmrc ~/.kwm/kwmrc
 brew services start koekeishiya/kwm/kwm

now you can reboot, and you should be good to go.

After rebooting, you’ll probably want to modify your KWMrc file to your liking, here’s a good starting point.

Here’s a screenshot since they’re cool and stuff [some of it is obfuscated fyi];


Adding Google Number w/ Adwords tracking to OptimizePress WordPress Theme

Recently I was tasked with adding number tracking w/ Adwords to a client’s website. They are using OptimizePress which isn’t very friendly for any user editing (no child themes, very confusing theme layout for modifications etc).

Anyway, I figured it out and thought others might need to know this, if nothing else, at least on how to edit the <body></body> tag to include an onload(); function 🙂

So, here’s what you do;

Edit the main theme’s ‘functions.php’, which, will be replaced upon an upgrade, so take note of that if you plan on upgrading OptimizePress at a later date (you should!).

function add_body_onload($c) {
 $c[] = ' onload="_googWcmGet(\'number\', \'+1-555-222-3333\')"';
 return $c;

Then, you’re going to want to edit the header file and add the following code at around line 344 of /lib/functions/page.php;

} else {
 $logo = '<div class="op-logo">test'.$logoH1Start.'<a href="'.esc_url( $header_link ).'"'.$title_str.' rel="home"><img src="'.$logoimg.'" alt="'.$alt.'" /></a>'.$logoH1End.'</div>';

changes to

} else {
 $logo = '<div class="op-logo"><a href="tel:+1-555-222-3333" id="number">555-222-3333</a></div>';

Then, login to the wordpress backend, and add these changes.

First, go to ‘optimizepress -> dashboard -> global settings -> custom css’ and add this

#number {
 font-weight: bold;
 font-size: 50px;
 color: #fff;
 line-height: 55px;

Now, save your changes.

Then, go to ‘optimizepress -> blog settings -> modules -> other scripts’ and add the script you got from Adwords, changing the YOUR_ID_HERE portion. Add this to one of the ‘header scripts’ boxes (or, create a new one);

<script type="text/javascript">
(function(a,e,c,f,g,h,b,d){var k={ak:"YOUR_ID_HERE",cl:"P8GfCKfi9mgQ6tz9oQM"};a[c]=a[c]||function(){(a[c].q=a[c].q||[]).push(arguments)};a[g]||(a[g]=k.ak);b=e.createElement(h);b.async=1;b.src="//";d=e.getElementsByTagName(h)[0];d.parentNode.insertBefore(b,d);a[f]=function(b,d,e){a[c](2,b,k,d,null,new Date,e)};a[f]()})(window,document,"_googWcmImpl","_googWcmGet","_googWcmAk","script");

<script type="text/javascript">
var callback = function(formatted_number, mobile_number)
 var e = document.getElementById("number");
 e.href = "tel:" + mobile_number;
 e.innerHTML = "";

And, that should be it. Now you’re going to want to test the site, by finding one of your ads, clicking it, and going to the page to make sure the number has changed to to one of your call extensions.

Compiling R1Soft Backup Agent on Ubuntu 16.x or 14.x


it’s a little different with these versions of ubuntu, you can follow the instructions below, but when it comes time to updating your grub config, do this instead.

# grep menuentry /boot/grub/grub.cfg

Which, will output all the kernels, which now you just have to ‘count’ the entries, so for example

if [ x"${feature_menuentry_id}" = xy ]; then
export menuentry_id_option
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-62-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-62-generic-advanced-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-62-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-62-generic-init-upstart-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-62-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-62-generic-recovery-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-59-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-59-generic-advanced-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-59-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-59-generic-init-upstart-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 4.4.0-59-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-59-generic-recovery-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 3.16.0-69-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-69-generic-advanced-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 3.16.0-69-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-69-generic-init-upstart-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
 menuentry 'Ubuntu, with Linux 3.16.0-69-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-69-generic-recovery-8e6c4ba1-8970-4c10-8245-ff967b14dad5' {
menuentry 'Memory test (memtest86+)' {
menuentry 'Memory test (memtest86+, serial console 115200)' {

Now, you just need to ‘count’ the entries, so for us we want to ‘downgrade’ to kernel, which, starting at 0, makes it be 7, on the advanced menu.

Because we have a sub menu to deal with, we’ll have to execute this command;

# sudo grub-set-default "1>7"

Which is telling it to use the 7th option, on the 1st option (the submenu for advanced). Now you just run update-grub, and reboot.

# sudo update-grub

Old article below:

If, like us, you use R1Soft backups, you may have recently encountered an error trying to get it to compile on your Ubuntu 14.x or 16.x machines.

This is because they are nearly a year out of date on compiling for the latest kernels, the newest one currently supported is actually 3.16, so, the agent will fail on anything newer than that. You can view all the available module versions from the R1soft repository, by clicking here.

Their support is basically useless [unless you pay], so, we had to find our own solution.

This isn’t the most elegant way to fix things, but, it works, so there’s that. [I guess]. Basically, 16.x comes with kernel 4.4, which won’t work, so what did we end up having to do? Downgrade the kernel!  

Well, not literally downgrade, we just used the older, supported kernel that was already installed.

To make this work for you, you’ll have to edit the grub configuration, by doing this.

# cp /etc/default/grub /etc/default/grub.bak

# nano /etc/default/grub

and make these changes


then exit and save the file.

Now, we’re going to have to find out which kernels you have installed, for us, we simply did the following;

# grep menuentry /boot/grub/grub.cfg

Which, will give you output similar to the following;

menuentry 'Ubuntu, with Linux 4.4.0-31-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 4.4.0-31-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-init-upstart-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 4.4.0-31-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.0-31-generic-recovery-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 3.16.0-77-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-77-generic-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 3.16.0-77-generic (upstart)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-77-generic-init-upstart-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {
menuentry 'Ubuntu, with Linux 3.16.0-77-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-77-generic-recovery-64f733aa-c9fe-4aed-b662-8fd6b99d6825' {

In our case, we want to use the version of the kernel, so, we simply issue these commands;

# grub-set-default "gnulinux-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825>gnulinux-3.16.0-77-generic-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825"
# grub-reboot "gnulinux-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825>gnulinux-3.16.0-77-generic-advanced-64f733aa-c9fe-4aed-b662-8fd6b99d6825"
# update-grub

then, you’re ready to reboot into your shiny old kernel

# reboot

now, you can verify that the R1Soft agent is working again, using this;

# hcp -v

Idera Hot Copy 5.14.4 build 433 (

Thank you for using Hot Copy!
Idera makes the only Continuous Data Protection software for Linux.

hcp driver module: 4.6.1 build: 41


# /usr/sbin/r1soft/bin/cdp -v
(R1Soft CDP Agent) version 5.14.4 build 433 2016/07/18 16:41:16

That’s it! you’ve got working backups again!