2014-11-27T12:32:14+02:00http://minuteware.net/Octopress2014-11-21T09:17:56+02:00http://minuteware.net/converting-python-datetime-object-to-utcWhile adding support for ISO 8601 date/time strings to Flask-RESTful I was struggling with all that hated Python timezone stuff, specifically with the need to convert a datetime object to UTC timezone. With the libraries that Flask-RESTful was already using this solution looked the easiest:

]]>2014-02-09T08:05:33+02:00http://minuteware.net/using-a-local-git-repository-in-jenkinsEven if you want to run a Jenkins server locally for testing purposes to correctly configure a job Jenkins still needs to fetch the source from a repository. With Git this can be easily done without configuring a Git server. Just specify the path to a local Git repo with file:// protocol like this:

1

file:///home/ay/dev/projects/my_new_project

Then input this path as repository URL in Jenkins.

]]>2014-02-08T18:59:08+02:00http://minuteware.net/global-gitignoreVery useful if you need, for example, to igonre the .idea directory in all your projects and not add it to each project’s .gitignore explicitly. To do so execute the following:

]]>2013-12-22T14:01:01+02:00http://minuteware.net/integrate-piwik-into-jekyllFirst we have to take the Piwik JavaScript Tracking Code from Piwik Administration website and replace Piwik URL and site ID with Jekyll variables, like so (note the {{ site.piwik.base_url }} and {{ site.piwik.site_id }}):

Now we need base_url and site_id variables defined in _config.yml. Add the following to _config.yml:

123

piwik:base_url:piwik.mydomain.netsite_id:1

For the default Jekyll template add the following after </head> tag in _layouts/default.html:

1

{%raw %}{%include piwik %}{%endraw %}

That’s it. After our website is rebuilt all the pages will include the above Piwik JS tracking code with variables replaced with their values from _config.yml

]]>2013-09-21T15:01:01+03:00http://minuteware.net/align-tab-text-in-firefoxLinux Mint uses it’s customized Firefox theme which has tabs text centered. This is not something you’d want if you are using Tree Style Tab extension. This can be overridden though. In your Firefox profile directory (which should be ~/.mozilla/firefox/<some_random_chars>.default) create a subdirectory called chrome and then create a file userChrome.css in this chrome subdirectory with the following content:

123

.tab-text{text-align:left!important;}

Restart Firefox and you’re done – tabs text is aligned left.

]]>2012-10-18T15:01:01+03:00http://minuteware.net/scrolling-background-windows-in-xfceI recently found that I was lacking this feature in my Xubuntu 12.04. I remember once having this on by default in KDE, so I wanted to find out how to do this in Xfce.

So this is what you need to do to enable background sccrolling in Xfce (in a terminal):

1

$ xfconf-query -c xfwm4 -p /general/raise_with_any_button -s false

Another way is to open Xfce Setting editor and navigate to xfwm4 -> general -> raise_with_any_button -> false

]]>2012-10-18T15:01:01+03:00http://minuteware.net/random-hostname-for-centos-kickstart-installationA cool option to install CentOS (and some other distros) is to use Kickstart. One thing I found missing in Kickstart is a possibility of adding some randomness to my installation out of the box. For example if deploying many CentOS virtual machines from one kiskstart file I wanted each of them to have a unique hostname. This is not possible to do with kickstart’s network --hostname=<my-hostname> option because it does not accept any code snippets. Instead this can be done with Kickstart’s %pre script.

This command will include the network --hostname option into your main Kickstart section and you will end up with a hostname like centos-2656530171

]]>2012-03-12T14:01:01+02:00http://minuteware.net/playing-alac-with-gstreamerI googled hard and installed lots of different packages until I found out that gstreamer-ffmpeg will do the job. Note that you might need to restart your player after installing it.
]]>2012-03-09T14:01:01+02:00http://minuteware.net/vmware-player-and-vmware-vix-the-specified-version-was-not-foundHaving VMware Player 4.0.2 and VIX 1.11 (the latest to the time of writing this) installed, it appeared that they don’t play well together. Trying to run my VM I was getting The specified version was not found error.

123

$ vmrun -T player start ~/vmware/gentoo/gentoo_x86.vmx nogui
Unable to connect to host.
Error: The specified version was not found

A solution to this problem is quite simple. Actually, as far as I can tell, this is a bug. There is a file /usr/lib/vmware/vixwrapper-product-config.txt, which is installed along with VMware Player, and maps VMware Player/Workstation versions to their corresponding VIX API versions. The problem is that the version of VMware Player in this file is 4.0.0, whereas I installed 4.0.2.

1

player 14 vmdb 4.0.0 Workstation-8.0.0-and-vSphere-5.0.0

I suspect VMware guys just forgot (and are sometimes forgetting, as this problem has been seen before) to update this file when releasing new version. So what you’ve got to do is to substitute 4.0.0 with the verion of Player you have installed.

]]>2012-01-10T14:01:01+02:00http://minuteware.net/disconnect-users-ssh-sessionWith my VPS I sometimes encounter a situation when I try to open a file with Vim, but it tells me the file has already been opened by someone else. This “someone else” is another myself, logged in via SSH from my laptop, which has been suspended (SSH sessions are not being disconnected when you suspend). An easy way to disconnect myself, logged in from the laptop, is using pkill.

1

$ pkill -KILL -u <username>

That’s it. SSH session has been disconnected and I can now open the desired file.

]]>2012-01-04T14:01:01+02:00http://minuteware.net/qt-apps-with-gtk-theme-in-xubuntu-11.10As you may have noticed, Qt apps no longer use GTK+ theme in Xubuntu 11.10. For me this became particularly noticeable in Psi+.
The problem is caused by QGtkStyle, which cannot find GTK+ theme since Xfce stores it in an unusual location (not sure why 11.04 could find it though).

To fix the problem add the following to ~/.config/xfce4/gtkrc (create the file if it does not exist):

]]>2012-01-04T14:01:01+02:00http://minuteware.net/multi-row-window-button-in-xfceTo make the Xfce Window Buttons applet (or simply the Taskbar, as all of us are used to call it) multi-row, add the following to ~/.config/xfce4/gtkrc (create the file if it doesn’t exist):

]]>2012-01-02T14:01:01+02:00http://minuteware.net/the-allmighty-watch-linux-commandI was searching for a way to make some kind of a live memory usage monitoring in Linux when I found watch. I wonder why didn’t I ever knew about it! It’s damn useful! You can monitor literally everything with watch.

Here are some scenarios you may use if for:

Watch for changes in a directory:

$ watch ls -la

Watch for any Java program being started/stopped:

$ watch -n 1 "ps ax | grep java"

I used watch for memory usage monitoring:

$ watch -n 1 free -m

$ watch -n 1 cat /proc/meminfo

]]>2011-12-28T14:01:01+02:00http://minuteware.net/simulating-high-memory-usage-in-linuxDoing some testing recently, I needed a way to eat up as much RAM as possible on a Linux machine. As it turned out, there are not as many ways to do that quickly and easily as one could have desired. I’ve found only two actually. The first one, using Bash arrays, is quite slow. The second one, using C malloc and memset functions, is quite insecure because you can end up in a completely unresponsive machine (its especially important if the machine is remote). It could be extended though, to support sleeps and the amount of memory to be allocated (also I had some problems with int type overflow if specifying huge amount of RAM), but not being familiar with C, I did not want to dive deep into the problem.

Trying to google a little harder I found another way to do that, similar to the malloc+memset one — C realloc function. Actually I was lucky to find a ready-to-use code on C on unix.com (thank you pludi). The only thing the code lacked was a sleep function to sleep for some time with memory allocated. I added it and here’s what I’ve ended up with.

]]>2011-12-25T14:01:01+02:00http://minuteware.net/fixing-the-mozilla-five-home-not-set-in-ubuntuThere is quite a lot of noise regarding this error in the Internet. It is being triggered by Eclipse’s (and Eclipse-based products’) SWT, whenever it tries to generate a ‘browser’ window (like the one used when you do git commit in Aptana).

The root cause of this error is that Eclipse’s SWT cannot find Mozilla’s Xulrunner, which it uses to draw ‘browser’ windows. It seems that the problem appeared with Firefox 3.0 (at least I’ve found a post of a guy who wrote he started to see this after his Firefox upgraded from 2.x to 3.0). For some reason SWT does not support Xulrunner of versions greater than 1.9.2.

Well, all the solutions found on StackOverflow, forums, bug trackers seem invalid. They all suggest to define the MOZILLA_FIVE_HOME environment variable and point it to the Xulrunner installation (wherever it’s installed, with the requirement that the directory should contain libxpcom.so). In my case the result was that even the downloaded and extracted old Xulrunner 1.9.2 refused to work.

Then, on the Eclipse SWT FAQ page I found out that you can define custom path to Xulrunner Eclipse should be using. This is done with org.eclipse.swt.browser.XULRunnerPath option. But my downloaded and extracted Xulrunner distribution refused to work this way.

Then I started searching for an Ubuntu package of that old Xulrunner 1.9.2 (thought it could be that the lib should actually reside in the lib path). Since Xulrunner seems no longer being distributed apart from Firefox (at least in Ubuntu), there is not separate Xulrunner package for Ubuntu in the repositories. But I was lucky to find one for Oneiric on Launchpad here