Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    Archive for the 'Notepad' Category

    Short miscellaneous notes

    MyISAM vs InnoDB vs Postgres benchmark

    6th October 2011

    For some reason, I believed that MyISAM storage engine should be very fast - faster than InnoDB and Postgres. After all, MyISAM does not support transactions, has no logging, and is overall simpler than "true" storage engines/databases.

    I was surprised to find out that this isn't true, at least for the specific (simple!) query I'm interested in:

    SQL:
    1. SELECT primary_id FROM tablename WHERE indexed_varchar = %s AND intcol1 <= %d AND intcol2> %d

    Read the rest of this entry »

    Share

    Posted in Notepad | No Comments »

    Python performance: set vs list

    15th August 2011

    Sometimes there is a need to be sure that no identifier is processed twice - for example, when parsing a file into a database, with file potentially containing duplicate records. An obvious solution is to properly wrap the DB insertion code into try...except block, and process duplicate primary ID exceptions. Another, sometimes more desired solution is to maintain a set/list of processed IDs internally, and check against that list prior to attempting the insertion of anything. So is it a set or a list?

    There are already quite a few internet resources discussing "python set vs list", but probably the simplest while elegant way to test that is below.
    Read the rest of this entry »

    Share

    Posted in Notepad, Programming, Python | 1 Comment »

    Phusion Passenger Apache users guide

    14th August 2011

    Phusion Passenger Apache users guide

    Also as a PDF.

    Share

    Posted in Links, Notepad, Software | No Comments »

    HandBrake profile for Nokia E71 default player

    13th August 2011

    Inspired by video encoding with handbrake.

    HandBrake is a very high-quality piece of software - next time you need recoding something into H.264/MPEG-4 (using MKV or MP4 containers) - try HandBrake. It easily saturated all my CPU cores - which I failed to achieve with ffmpeg, which even with threads=8 was only saturating 2 cores.

    Attached to this post are 2 profiles for recoding movies for Nokia E71. The "_best" profile has exhaustive motion detection, otherwise is identical to the base profile.
    E71.plist
    E71_best.plist

    Related:

    Share

    Posted in Links, Misc, Movies, Notepad | No Comments »

    Generate .mood moodbar files for your whole music collection

    10th April 2011

    Amarok moodbar wiki page has 2 nice scripts to generate .mood files for your whole music collection (to be displayed by amarok when playing).

    Read the rest of this entry »

    Share

    Posted in *nix, Links, Notepad, Software | No Comments »

    How to truncate git history (sample script included)

    28th March 2011

    Under a few assumptions (most importantly - you do not have any non-merged branches,), it is very easy to throw away git repository commits older than an arbitrarily-chosen commit.

    Here's a sample script (call it e.g. git-truncate and put into your ~/bin or whichever location you have in PATH).

    CODE:
    1. #!/bin/bash
    2. git checkout --orphan temp $1
    3. git commit -m "Truncated history"
    4. git rebase --onto temp $1 master
    5. git branch -D temp

    Invocation: cd to your repository, then git-truncate refspec, where refspec is either a commit's SHA1 hash-id, or a tag.

    Expected result: a git repository starting with "Truncated history" initial commit, and continuing to the tip of the branch you were on when calling the script.

    If you truncate repositories often, then consider adding an optional 2nd argument (truncate-commit message) and also some safeguards against improper use - currently, even if refspec is wrong, the script will not abort after a failed checkout.

    Thanks for posting any improvements you may have.

    Source: Tekkub's post on github discussions.
    See also: how to remove a single file from all of git's commits.

    Share

    Posted in how-to, Notepad | No Comments »

    How to easily install any PyPi/easy_install python module on Debian

    16th February 2011

    Imagine you need to install pycassa (which uses easy_install). Here are the 2 (at maximum) very simple steps to have it properly debianized and installed on your Debian/Ubuntu:

    • if you don't have the python-stdeb package: sudo aptitude install python-stdeb
    • pypi-install pycassa

    That's it.

    Refer to stdeb readme for more information. You will need that if there are dependencies - which might not be resolved automatically by stdeb.

    Before stdeb, it wasn't exactly trivial to make a .deb from python module.

    Share

    Posted in *nix, how-to, Notepad, Python, Software | 1 Comment »