Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    rtorrent-enhanced with ipfilter and GeoIP: Debian Squeeze amd64 package

    1st April 2011

    rtorrent-eyecandy
    rtorrent is an excellent ncurses rtorrent client.

    There are a few highly-popular patches, which haven’t yet made it into the Squeeze’s rtorrent version 0.8.6.

    Note: ArchLinux already has an rtorrent-extended package, so you may want to look at that one (instead of my Debian package below). I might use Arch’s patchset next time to generate a truly extended rtorrent package.

    I’ve incorporated 3 of such patches (#239 ipfilter, #2064 GeoIP support, and #2171 colours/eyecandy), and built a squeeze amd64 rtorrent-enhanced package.

    A few excerpts to explain how these extra features are to be configured and used (all come from the above-mentioned trac tickets, some were edited/extended).

    ipfilter

    ipfilter allows to selectively blacklist/whitelist peers – based on IP address range files (so-called ipfilter files). The ipfilter files may, for example, come from bluetack.co.uk. Each line of the file contains a record in this format: range_description:start_IP-end_IP, where start_IP should be less than or equal to end_IP. Multiple files can be used. Overlapping ranges are merged automatically. Both incoming and outgoing connections are checked against the filter. Exclusions are not supported, so connection to/from IPs in all the loaded ranges will be disallowed and dropped.

    Include “ip_filter=” directive in .rtorrent.rc. For example (paths are specified relative to user’s home directory):
    ip_filter=ipfilter/level1,ipfilter/level2

    It is probably a good idea to reload ipfilter files once in a while, so you can also include “reload_ip_filter” directive on schedule to refresh the filter. The same files named in “ip_filter” will be reloaded.

    schedule = filter,18:30:00,24:00:00,reload_ip_filter=

    To support the feature you may want to setup cron job to reload and unzip files from bluetack. Examples here and here.

    GeoIP

    In the Peers view of each torrent a new column – CC, country code – is added, which shows peer’s country code. When examining each peer, you will see more data from the GeoIP database (if you have the relevant files installed): AS num and city. At the very least, you need to have geoip-database installed. You can get free “lite” versions of city/AS-databases, rename them (removing “lite”) and put into an appropriate location to make rtorrent+geoip use them as well. Geop-isp data support isn’t integrated into this rtorrent package.

    Colours

    This patch somewhat changes the way rtorrent shows torrents. Seeding torrents have bold titles, there are no half-displayed torrents at the top/bottom when scrolling, and you can configure colours for active/done torrents (ticket libtorrent.rakshasa.no/ticket/1382, which seems to be gone now). Source code and testing hint at these configurable colours: done_fg_color, done_bg_color, active_fg_color, active_bg_color, and at these possible values: 1 (red), 2 (green), 3 (yellow).

    Geek’s cellar
    A related (though not used in any way for the preparation of the package) resource is rtorrent mods page.

    Relatively schematically, applying patches and building the package was performed in these steps (starting within some newly-created directory):

    1. sudo aptitude install cdbs devscripts [and whatever else you find you're missing]
    2. apt-get source rtorrent
    3. dpkg-source -x rtorrent_0.8.6-1.dsc
    4. cd rtorrent-0.8.6
    5. cdbs-edit-patch 01-ipfilter.patch
    6. patch -p1 < /path/to/patch/239
    7. exit 0
    8. cdbs-edit-patch 02-geoip.patch
    9. patch -p1 < /path/to/patch/2064-after-ipfilter
    10. exit 0
    11. cdbs-edit-patch 03-eyecandy.patch
    12. patch -p1 < /path/to/patch/2171-mod-with-canvas
    13. exit 0 [you could do all 3 patches together, but I prefer cleaner and manageable approaches]
    14. [some weird operation to be explained below]
    15. dpkg-buildpackage

    Weird operation: I didn’t know how to make dpkg-buildpackage run autorun.sh (which is required for one of the patches I’ve used) before configure (could someone enlighten me how to do that?), so I started a new patch with cdbs-edit-patch, then ran one by one `autoreconf -if`, `./autorun.sh`, `./configure`, exited with zero status and was done with that problem. The resulting “patch” was 2MB large :)

    Posted in *nix, 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).


    #!/bin/bash
    git checkout --orphan temp $1
    git commit -m "Truncated history"
    git rebase --onto temp $1 master
    git branch -D temp
    # The following 2 commands are optional - they keep your git repo in good shape.
    git prune --progress # delete all the objects w/o references
    git gc --aggressive # aggressively collect garbage; may take a lot of time on large repos

    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.

    Posted in how-to, Notepad | 12 Comments »

    How to fix: Nokia Ovi Suite could not connect to the Nokia account server

    10th March 2011

    I’ve been getting this message for a long while, when trying to log into Ovi from within my Ovi Suite:

    Nokia Ovi Suite could not connect to the Nokia account server. Make sure the internet connection is working properly and try again.

    However, both my internet connection, and logging into ovi.com using a browser work fine. Even looking for updates from within Ovi Suite works fine!

    Here’s the solution (tested on Nokia Ovi Suite 3.0.0.290):
    Read the rest of this entry »

    Posted in how-to, Misc | 21 Comments »

    Amazonia! 6462 human microarray datasets

    6th March 2011

    Amazonia!Amazonia! – explore the jungle of microarray results

    Paradoxically, the tremendous downpour of microarray results prevents a simple use of expression data. Therefore, we propose a thematic entry to public transcriptomes: you may for instance query a gene on a “Stem Cells page”, where you will see the expression of your favorite gene across selected microarray experiments related to stem cell biology. This selection of samples can be customized at will among the 6462 samples currently present in the database.

    Every transcriptome study results in the identification of lists of genes relevant to a given biological condition. In order to include this valuable information in any new query in the Amazonia! database, we indicate for each gene in which lists it is included. This is a straightforward and efficient way to synthesize hundreds of microarray publications.

    A special feature of Amazonia! is the field of human stem cells, notably embryonic stem cells.

    Posted in Bioinformatics, Links, Science | No Comments »

    Introduction to Python for bioinformatics

    25th February 2011

    This overview presentation is two years old, but still a highly valuable resource: modules and tools mentioned are alive and useful.
    I think this is the second presentation by Giovanni I’m embedding (first one being about GNU/make for bioinformatics).

    Posted in Bioinformatics, Links, Python, Software | 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.

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

    MySQL as NoSQL with HandlerSocket: 750000 qps

    25th January 2011

    HandlerSocket provides a direct access to InnoDB storage, bypassing SQL interpretation layer. With in-RAM data, it may raise MySQL performance to 750000 queries per second.

    Posted in Links, Software | No Comments »