Linux Laptop Environment Setup

I’m regularly asked about the setup of my laptop: a System76 Gazelle Professional named Felix running Ubuntu 14.04. Writing a return to that query produced the following:

Chromium Addons:

Pocket #Formerly Read It Later
Lazarus
GmailTeX #Gmail + LaTeX = GmailTeX
AdBlock [for YouTube] #Saves time
Session Buddy
Diigo
HTTPS Everywhere
Disconnect
Incognito-Filter #Great for keeping facebook.com, accounts.google.com, etc. from hijacking web history
Hacker Vision #Save your eyes!
The Great Suspender #Suspends tabs not in use
What font? #satisfies curiosity
Wolfram Alpha
GHangouts
Chrome Downloads
Have I Downloaded This Before?
BetterTube #Optimize your YouTube experience

Get Flashplugin working on Chromium:

get adobe-flashplugin
#if that doesn't work, try:
sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update && sudo apt-get install flashplugin-installer

Some of my favorite term aliases*:

alias up='sudo apt-get update && sudo apt-get upgrade'
alias meta='sudo vi ~/.bashrc'
alias rmeta='. ~/.bashrc'
alias sag='sudo apt-get'
alias cx='chmod +x'
alias purge='rm `find *~`'
alias ip='ifconfig  | grep "inet addr:"| grep -v "127.0.0.1" | cut -d: -f2 | awk "{ print $1}"'
alias get='sudo apt-get install'
alias matlab='matlab -glnx86'
alias p='python'
alias pipi='sudo pip install'
alias sim='cd ~/V-REP_PRO_EDU_V3_0_4_64_Linux/ && ./vrep.sh'

Python-based Research:

get python-pip #pip for managing packages
get build-essential liblapack-dev gfortran gcc g++ 
#Either the ATLAS or OpenBLAS implementation of BLAS. OpenBLAS is speedier but finnicky wrt multiprocessing.
get libatlas-dev libatlas3-base 
#or
get libopenblas-dev
sudo easy_install -U distribute
pipi dev numpy scipy setuptools matplotlib
pipi nose #nicer testing

#Machine Learning
pipi -U scikit-learn

#Computer Vision
get gcc g++ cmake
#download latest opencv from #<a href="http://opencv.org/downloads.html">website</a>
#untar it with
tar -xvf opencv-* #or
unzip opencv-*
#inside untarred folder make new folder call "r" (arbitrary name)
#run the following command in it
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..
make
make install

A few choice packages/programs:

get guake #drop down term window - crazy useful (Sublime users: check <a href="http://www.pztrick.com/blog/2013/05/11/ubuntu-guake-terminal-and-sublime-text-hackery/">this</a> out)
get vim 
get screen
get tex4ht #convert LaTeX to html
get chromium-browser #Preferred browser
get gparted #for managing partitions
get wine #Run (some) Windows on Linux
get haskell-platform
get vlc #My favorite multimedia plugin
get ipython #Bro, do you even Python?
get texmaker #LaTeX editor of choice (gedit plugin is also nice)
get openjdk-6-jre openjdk-7-jre #Open source Java platform
get geary #Alternative to thunderbird
get gwenview #crop pictures
get p7zip #extract *.7z files
get unrar #extract rar
get bleachbit #free your disk space

get xmonad suckless-tools #window manager

#ffmpeg
get libav-tools
sudo add-apt-repository ppa:samrog131/ppa
sudo apt-get update
get ffmpeg

#dropbox
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86" | tar xzf -
~/.dropbox-dist/dropboxd

#broke grub?
sudo add-apt-repository ppa:yannubuntu/boot-repair
up
get -y boot-repair
boot-repair #run boot-repair after installation

#Be safe, use a proxy or VPN (<a href="http://www.danscourses.com/Linux-Fundamentals/install-a-configure-squid-in-ubuntu.html">more info</a>)
get squid squid-common
#Note: If you are running 13.04, sudo service squid3 (start|stop|restart)

#evernote on linux
sudo add-apt-repository ppa:nvbn-rm/ppa
sudo apt-get update && sudo apt-get install everpad

#numlock activates at startup
sudo apt-get -y install numlockx
sudo sed -i 's|^exit 0.*$|# Numlock enablen[ -x /usr/bin/numlockx ] && numlockx onnnexit 0|' /etc/rc.local

"""
For quick scripting, I use or <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a> or <a href="http://www.sublimetext.com/2">Sublime</a> with vim command mode enabled. 
To enable control mode in Sublime Text 2: Find Preferences.sublime-settings 
Change the line "ignored_packages": ["Vintage"] to "ignored_packages": []. 
Restart Sublime: boom! Vim controls.
"""

#xscreensaver
sudo apt-get remove gnome-screensaver
sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra

#Oracle(Sun) Java (<a href="https://github.com/flexiondotorg/oab-java6/blob/master/README.md">docs</a>)
cd ~/
wget https://github.com/flexiondotorg/oab-java6/raw/0.3.0/oab-java.sh -O oab-java.sh
chmod +x oab-java.sh
sudo ./oab-java.sh
get sun-java6-jre

#VMWare <a href="http://www.vmware.com/products/workstation/workstation-evaluation">Workstation</a>

#compiz
get compiz compizconfig-settings-manager compiz-fusion-plugins-extra compiz-fusion-plugins-main compiz-plugins

#matlab from cd
cd /media/MATLAB{version}
gksu ./install

#blender
sudo add-apt-repository ppa:irie/blender
sudo apt-get update
get blender

get myunity #Awesome control panel for unity
#Deprecated: get unity-tweak-tool 

#My free robotics simulator of choice, the educational version is free for all and available for OSX, Windows, 32 and 64bit Linux
<a href="http://www.coppeliarobotics.com/downloads.html">v-rep</a>

*To edit your own cd && vim ~/.bashrc 
After editing, refresh your bashrc with . ~/.bashrc. Now your aliases can be used! Huzzah!

Using a US Keyboard Layout to type in German? Lesen diesen Beitrag für deutsche Tastaturkürzel.

Force Quit in Ubuntu

A surprising amount of Linux users are unfamiliar with how to force quit programs via the commandline. It is often that your only option to escape a process gone awry is using the term window.

I was coding with some friends yesterday and to my surprise, they didn’t know how to quit an unresponsive process. I fear that this ignorance is widespread. The procedure is fairly simple. Use the following command to list ongoing processes:

ps x

After you’ve located the UID of the problem process (usually a 4 or 5 digit natural number), kill it.

Let’s say our UID is 27182.

kill -9 27182

Done!

Adding Weather Indicator

Get Weather on the Unity top panel in Ubuntu! Worry not, this tutorial doesn’t assume any term aliases.

sudo add-apt-repository ppa:weather-indicator-team/ppa
sudo apt-get update
sudo apt-get install indicator-weather

If you’d like the indicator to launch upon startup, hit the super key and search for Startup Applications. Click on the icon, click Add, pick an arbitrary name, and enter indicator-weather as the command.

Sidenote:
I personally prefer to use Celsius. If you were raised with the Imperial system, then I suggest using the following poem to transition.

30’s hot,
20’s nice,
10’s cold,
0’s ice.

Happy hacking!

Installing CoffeeScript on Ubuntu 13.04

Unfortunately, the current CoffeeScript docs do not support installation on the latest Ubuntu distro. To get around this, we must manually install the dependencies. Don’t worry, I’ve done most of the work for you.

Create a plain text file, vi installcoffee.sh  and insert the following:
<code>sudo apt-get update
sudo apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/joyent/node.git && cd node
./configure
make 
sudo make install
cd
curl http://npmjs.org/install.sh | sudo sh
sudo npm install -g coffee-script</code>

Save Esc + : + w and run the script . installcoffee.sh

Setting Up pygeoip Environment on Ubuntu

GeoIP uses a large database to find information about a given IP address or website. I went through a couple different package installations before it integrated with my programs successfully. The fairly simple process I settled upon to set up the functional package, pygeoip (python API for GeoIP),  is as follows:

sudo easy_install pygeoip
cd <span style="color: #808030;">/</span>usr
<div style="font-family: verdana;">
To find the path of GeoIP.dat, embrace the power of ` 
(not ', ` on US keyboards shares a key with ~). </div>
find <span style="color: #e34adc;">`pwd`</span> <span style="color: #808030;">-</span>name <span style="color: #0000e6;">'GeoIP.dat'</span> 
After downloading GeoLiteCity.dat, a simple way rename the file to GeoIPCity.dat whilst moving said file to the same path as GeoIP.dat (for convenience)...

sudo mv Downloads/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat

In order to check the success of your environment's set-up, run this as a py script or in a term window
<span style="color: maroon; font-weight: bold;">import</span> pygeoip
<span style="color: dimgrey;">#gi = pygeoip.GeoIP('/usr/share/GeoIP/GeoIP.dat', pygeoip.MEMORY_CACHE)</span>
gi <span style="color: #808030;">=</span> pygeoip<span style="color: #808030;">.</span>GeoIP<span style="color: #808030;">(</span><span style="color: #0000e6;">'/usr/share/GeoIP/GeoIPCity.dat'</span><span style="color: #808030;">)</span>
<span style="color: maroon; font-weight: bold;">print</span> gi<span style="color: #808030;">.</span>record_by_addr<span style="color: #808030;">(</span><span style="color: #0000e6;">'64.233.161.99'</span><span style="color: #808030;">)</span>

(Thanks http://tohtml.com/)