Tuesday, July 29, 2014

Git: Show updated tree of branches in console

To do this, just add the following to ~/.gitconfig[alias]
  tree = log --graph --all --decorate --pretty=oneline --abbrev-commit
Then git tree will give text based tree of branches:

To run git tree in console showing e.g. 20 latest commits we can run git tree in a while loop as follows: while true; do clear; git tree -20; sleep 2; done

Wednesday, July 23, 2014

Gnome 3.12: Add VirtualBox machine to gnome's activities and dash

Specific virtual machines can be launched directly from gnome activities or gnome dash without the need to start standard Virtual Box GUI. For this we need to create desktop files and place them in our local applications folder, i.e., /.local/share/applications.
Example of a desktop file starting virtual machine called w7 is as follows (file name w7.desktop) These files can be created manually, but also using Virtual Box GUI. Once we have these files, it is enough just to copy them into /.local/share/applications and they will be e immediately available in the gnomes activities. From the we can just drop and drag them to dash.
If we want to create them manually, we can use the example from the above. The ids of the virtual machines can be obtained using the following vboxmanage list vms
"w7" {25e911a6-7bae-422a-84c2-30ced68d701d}

Tuesday, July 22, 2014

Gnome 3.12: Auto start applications with a delay

In gnome, applications can be start by copying *.desktop files into ~/.config/autostart.

The installed desktop files of your applications are in /usr/share/applications and in ~/.local/share/applications. Thus you can copy files from there into ~/.config/autostart and modify to your liking.

Off course, you can also create your own desktop files for running, or starting applications with a delay. For example, I made the desktop file called myautostart.desktop in ~/.config/autostart[Desktop Entry]
Type=Application
Name=MyStartup
Comment=Starts my applications
Exec=/bin/bash /home/put-your-user-name/.mystartups.sh
X-GNOME-Autostart-enabled=true
Hidden=false
NoDisplay=false

As can be seen the file starts ~/.mystartups.sh which has the following contents:#!/bin/bash
sleep 2
exo-open /usr/share/applications/terminator.desktop
sleep 1
exo-open /usr/share/applications/chromium.desktop

The file launches terminator and chromium using desktop files with 2 and 1 second delays.

Sunday, July 20, 2014

Imagemagick: Flattening tiff images

mogrify -alpha off -colorspace gray -depth 8 -flatten *.tiff

Ubuntu: Fix ntfs parition on usb drive

If there are problems with mounting usb thumb drive (in my case the usb is /dev/sdc1), one can use this:sudo ntfsfix /dev/sdc1

Saturday, July 12, 2014

Capture desktop using ffmpeg and re-size the resulting video.

The following command can be used to record your display and the compress the resulting image ffmpeg -f x11grab -video_size 2560x1440 -i $DISPLAY -f alsa -i default -c:v ffvhuff -c:a flac test.mkv
ffmpeg -i test.mkv -vcodec libx264 -preset ultrafast -qp 0 -acodec copy -vf scale=-1:720 output.mkv

Thursday, July 03, 2014

How to install virtual environment of Python 3.4.x from source in Ubuntu 14.04

Below is a recipe that I use to used to install and set-up virtual environment of Python 3.4.x in Ubuntu 14.04 x64.