Archive for the ‘howto’ Category


Install python stack on Ubuntu 16.04

In howto on May 22, 2017 by theoryl Tagged:

Note to self:

# First, install pip
sudo apt install python-pip

# Upgrade pip
sudo -H pip install --upgrade pip

# Install python stack using pip
sudo -H pip install setuptools
sudo -H pip install ipython
sudo -H pip install numpy scipy
sudo -H pip install matplotlib pandas
sudo -H pip install Theano
sudo -H pip install keras


Find and replace in all the files

In howto on Nov 17, 2016 by theoryl Tagged: , ,

This simple one liner does it:

find ./ -type f -exec sed -i -e 's/apple/orange/g' {} \;

from StackOverflow


Parallelize using xargs

In howto on Sep 7, 2016 by theoryl Tagged: , , , ,

According to this answer on StackOverflow: , you can easily parallelize tasks using xargs. To quote the given example:

$ find . -type f -name '*.wav' -print0 | xargs -0 -P 3 -n 1 flac -V8

This example will encode *.wav => *.flac, using three processes at once (-P 3).


Install IPython on Ubuntu

In howto on Aug 3, 2016 by theoryl Tagged: , , , ,

IPython is a much more powerful shell than the usual Python shell. As Ubuntu and Linux Mint are already shipped with python and pip, installing IPython is trivial:

sudo pip install ipython

VoilĂ !


Build Boost 1.55 on Linux

In howto on Aug 2, 2016 by theoryl Tagged: , ,

Boost is a very extensive C++ library. To compile + install:

tar xz boost_1_55_0.tar.bz2
cd boost_1_55_0
mkdir ../boost
./ --prefix=../boost
./b2 install


Checkout subdirectory in a git repository

In howto on Jul 13, 2016 by theoryl Tagged: , , ,

To checkout a subdirectory in a Git repository using sparse-checkout, follow these instructions

git remote add -f origin
git config core.sparsecheckout true
echo /path/to/subdirectory >> .git/info/sparse-checkout
git checkout master


git clone
cd whatever
git config core.sparsecheckout true
echo /path/to/subdirectory >> .git/info/sparse-checkout
git read-tree -mu HEAD

Also see this StackOverflow answer.


How to sync a forked git repository?

In howto on Jul 13, 2016 by theoryl Tagged: , , ,

To synchronize your forked Git repository with the upstream, follow these nice instructions on StackOverflow:

# Add the remote, call it "upstream":

git remote add upstream

# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:

git fetch upstream

# Make sure that you're on your master branch:

git checkout master

# Rewrite your master branch so that any commits of yours that
# aren't already in upstream/master are replayed on top of that
# other branch:

git rebase upstream/master

# If you don't want to rewrite the history of your master branch,
# then you should replace the last command with the following

#git merge upstream/master

# Now push your branch to your own forked repository

git push origin master

# If you've rebased your branch onto upstream/master you may need to
# force the push in order to push it to your own forked repository

#git push -f origin master