Category: Nerd Stuff

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 https://raw.githubusercontent.com/Homebrew/install/master/install)"

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
 add
 /usr/local/bin/zsh
 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
 or
 echo $SHELL

copy this in to your .zshrc

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

Now, let’s install instantly awesome Zsh

 cd ~/Documents/Source/
 git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
 setopt EXTENDED_GLOB
 for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
 ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
 done

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'

to

 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 https://github.com/tony/tmux-config.git ~/.tmux
ln -s ~/.tmux/.tmux.conf ~/.tmux.conf
cd ~/.tmux
git submodule init
git submodule update
cd ~/.tmux/vendor/tmux-mem-cpu-load
cmake .
make
sudo make install
cd ~
git clone https://github.com/powerline/fonts.git fonts
cd ~/fonts 
pip install --user powerline-status
cd ..
git clone https://github.com/kovidgoyal/powerline-daemon.git pld
cd ~/pld 
gcc -O3 powerline-client.c -o powerline-client
chmod +x powerline-daemon
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 https://github.com/jaredculp/iterm2-borderless-padding.git iterm2-borderless-padding
 cd iterm2-borderless-padding
 ./install.sh 20 20
 mv ./iTerm2/build/Development/iTerm2.app /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];

ss

Compiling Hyperion for Phillips Hue support on Mac OSX

I’ve been looking at the Lightberry for a little while now and have been thinking about how I’ll be implementing it once I actyually buy it and add it to my setup.

The Lightberry is pretty cool, it works with a Raspberri Pi and a bunch of video grabbing / repeating so you can get lights behind your television that look like those really expensive TV’s for about 1/10th of the cost.

The end goal is that it will look something like this.

Of course, I wanted to go a step furthur than the default setup and have it so I could also control my Phillips hue lights to go along with the display on the screen. Originally, I was thinking this would be neat in video games or movies, but in practice it was a little annoying.

However, I still think it would be really neat to get these going for music visualization, so I’ll have a really high tech color organ basically.

Let’s get started, shall we?

PREREQUISITES

** I am running OSX El Capitain so your instructions may change slightly
** make sure you have java latest jdk, sdk installed
** make sure you have the latest xcode for your os (10.10, 10.11, etc)

INSTRUCTIONS

  1. Install MacPorts if not already installed
  2. Download HyperCon and Hyperion and put in a safe place
  3. Create a development account for your HUE lights in order to access them from Hyperion
    1. follow these instructions to get your hue bridge ready for api access:
    2. For my settings I entered in
      {"devicetype":"huelight#macmini matt"}

      and got (after button press and refresh)

      [
       {
       "success": {
       "username": "253b32e51a5939e7288e66b11ddff113"
       }
       }
      ]
  4. Now install some stuff on your mac if you already have some of these they’ll be skipped
    # sudo port install screen findutils git cmake qt4-mac libusb doxygen
  5. Get Hyperion
    # cd ~/Documents
    # nano ~/.bash_profile

    add the qt path, by adding the following lines to the end of the file

    export PATH="/opt/local/libexec/qt4/bin:/opt/hyperion/bin:$PATH"
    # export HYPERION_DIR="hyperion"
    # git clone --recursive https://github.com/tvdzwan/hyperion.git "$HYPERION_DIR"
    # mkdir "$HYPERION_DIR/build"
    # cd "$HYPERION_DIR/build"
    # cmake -DENABLE_DISPMANX=OFF \
     -DENABLE_SPIDEV=OFF \
     -DENABLE_V4L2=OFF \
     -DENABLE_OSX=ON ..
    # cd ..
    # make
    # mkdir /opt/hyperion
    # mkdir /opt/hyperion/bin
    # mkdir /opt/hyperion/init.d
    # mkdir /opt/hyperion/effects
    # mkdir /opt/hyperion/config
    # cp ./bin/hyperiond /opt/hyperion/bin
    # cp ./bin/hyperion-remote /opt/hyperion/bin
    # cd effects && cp * /opt/hyperion/effects && cd ..
    # cp ./bin/hyperion.init.sh /opt/hyperion/init.d
    # cp ./config/hyperion.config.json /opt/hyperion/config
    # chmod +x /opt/hyperion/bin/*

    Note, that you may have compile problems with it saying it can’t find COPY_ONLY, this was apparently due to a typo in some documentation, so it made it into this. Here’s how you fix that;

    # cd ~/Documents/hyperion 
    # nano cmake/qt4/Qt4Macros.cmake

    Now just find the instance of COPY_ONLY and replace it with COPYONLY. Close and save the file. Then re-try compiling the program

  6. Create a configuration file, mine is attached below (which is the same as their example, except I changed bootup to Knight rider effect instead). Download my hue.json configuration file here. Copy it to your /opt/hyperion/config directory and change the username, as well as the IP.
  7. Start Hyperion like this
    # sudo /opt/hyperion/bin/hyperiond /opt/hyperion/config/hue.json.txt
  8. Now you should see the lights come on, and do the initial boot sequence. Yay!

Now, because I don’t yet have the Lightberry, I can only test with Kodi / XBMC or the Hyperion Free app for Android for it to get it’s color data from. I primarily (only) use PLEX so, this was a problem but I assume it will be solved once I have the frame grabber, and use the tools provided by Lightberry.

So, for now if I want visualizations to the music played, I open up Kodi / XBMC and play music from there and the lights pulsate to it as expected.

Once I get the lightberry, I’ll remove Kodi from the equation, as everything going through my receiver has one output to the telvision, which I’ll capture and use instead. Much easier!

I will post any updates when I continue the setup and integration.

REFERENCES

Rogers Canada MMS APN settings for Unlocked Phones

I had to setup my phone today for MMS, and it took forever to find the proper settings online. Just go into settings, wireless, apn settings, and add a new APN for rogers MMS.

Hopefully someone else up here in Canuckistan can use this;

Name: Rogers MMS
APN: media.com
Username: media
Password: mda01
Server: 172.25.0.107
MMSC: http://mms.gprs.rogers.com
MMS Proxy: 10.128.1.69
MMS Port: 80
MCC :302 (should already be filled in)
MNC: either 720 or 72 depending on your SIM card (should already be filled in)
APN Type: mms

Enjoy MMS!