Le blog de pingou

To content | To menu | To search

Tag - Astuces

Entries feed - Comments feed

Friday, June 26 2015

Packagers AFK in pkgdb

I just wanted to point out a small feature added to pkgdb recently.

Basically, it integrates with the vacation calendar of fedocal to show on the packager's info page if the person is on vacations or not.

If you are dealing with someone who is slow to answer on bugs, irc or emails, it may give you an insight as to why that is.


Note: I am in no way saying that Paul is slow to answer bugs, irc or email, and have merely used him to illustrate my thoughts following up on his post about the Red Hat summit and I shall not be held responsible for any variations in Paul's response time :-)

Thursday, May 7 2015

Check packages in anitya and pkgdb2 for monitoring

A little while ago I presented a script allowing to search for the packages of a specified user and see which are missing from either anitya or are not being monitored in pkgdb2.

This script however, only check someone's packages and someone time we want to check a number of packages at once, eventually, all the packages matching a given template.

This new script does just that:

 $ python pkgs_not_in_anitya_2.py 'drupal-*'
   drupal-service_links                 Monitor=False   Anitya=False
   drupal-calendar                      Monitor=False   Anitya=False
   drupal-cck                           Monitor=False   Anitya=False
   drupal-date                          Monitor=False   Anitya=False
   drupal-workspace                     Monitor=False   Anitya=False
   drupal-views                         Monitor=False   Anitya=False

If you are interested, feel free to use the script

Friday, April 3 2015

OpenSearch integration in pkgdb

One of the earliest feature request of pkgdb2 (that was present in pkgdb1) is the browser search integration.

This integration is based on the OpenSearch specifications and basically allows to use pkgdb as one of the search engine of your web browser just like you can use google, duckduckgo or wikipedia.

I recently found out this feature is not so well known, so I thought I would present it and explain how to set it up (screenshot are on Firefox).

1/ Go to https://admin.fedoraproject.org/pkgdb and click on the list of search engines at the top right.

2/ Select the entry Add "Fedora PkgDB2: Packages"

That's it you are done for the most important step :)


Now something which I do and find most useful is:

3/ Go to Manage Search Engines...

There, with the search engine pkgdb packages associate the keyword pkgdb


Now, you can use your url bar as usual but when you enter pkgdb <something> it will search this <something> in pkgdb directly. So for example, if you want to search for guake in pkgdb, you would type in your url bar pkgdb guake.


The bonus point is that since there is only one package with this name, you will be immediately redirected to its page.

This way, when you want to quickly find information about a package in pkgdb, you can get it from your browser in one simple step (eventually two if several package match the keyword you entered).

Final bonus point? To access pkgdb directly, enter in the url bar: "pkgdb " (with a space at the end), without a keyword, Firefox will bring you directly to the front page of the application.

Wednesday, February 25 2015

Check your packages in pkgdb and anitya

The question was asked on the devel list earlier if there was a way to check all one's packages for their status in pkgdb and whether they are in anitya.

So I just cooked up quickly a small script to do just that, it retrieves all the packages in pkgdb that you are point of contact or co-maintainer and tells you if its monitoring flag is on or off in pkgdb and if it could be found in anitya.

For example for me (partial output):

$ python pkgs_not_in_anitya.py pingou
   * point of contact
     R-ALL                                Monitor=False   Anitya=False
     R-AnnotationDbi                      Monitor=False   Anitya=False
     guake                                Monitor=True    Anitya=True
     igraph                               Monitor=False   Anitya=False
     jdependency                          Monitor=True    Anitya=True
     libdivecomputer                      Monitor=True    Anitya=True
     metamorphose2                        Monitor=False   Anitya=False
     packagedb-cli                        Monitor=False   Anitya=False
   * co-maintained
     R-qtl                                Monitor=False   Anitya=False
     fedora-review                        Monitor=True    Anitya=True
     geany                                Monitor=True    Anitya=True
     geany-plugins                        Monitor=True    Anitya=True
     homebank                             Monitor=True    Anitya=True
     libfprint                            Monitor=True    Anitya=True

If you are interested, feel free to use the script

Tuesday, December 30 2014

Firefox private browsing directly

I use the private mode of firefox quite often, for example when I want to test an application while being authenticated in one windown and not authenticated in another window.

I also use this mode when I want to browse some commercial websites that I know do a lot of tracking (hey there amazon!).

Finally, my firefox always have few windows and a bunch of tabs open and when traveling quite often I want to open firefox quickly to check something but I do not want to have it coming with all its windows and tabs.

Until now, I used either different browser or midori that allows starting it directly in private mode in these situations.

So this morning I took myself by the hand and looked closer at fixing my system for my use-case:

The recipe turned out to be pretty simple:

1/ Get the firefox.desktop file:

 cp /usr/share/applications/firefox.desktop ~/firefox-private.desktop

2/ Adjust it as follow:

+Name=Firefox (private browsing)
-Exec=firefox %u
+Exec=firefox -private-window %u

3/ Install the new desktop file:

3.1/ In /usr/share/applications/ for every users on the system

 sudo cp ~/firefox-private.desktop /usr/share/applications/


3.2/ In ~/.local/share/applications/ for your user only

 sudo cp /.local/share/applications/

With this trick, you can now start firefox in private browsing mode directly from the menu.

Thursday, November 27 2014

Python multiprocessing and queue

Every once in a while I want to run a program in parallel but gather its output in a single process so that I do not have concurrent accesses (think for example, several process computing something and storing the output in a file or in a database). I could use locks for this but I figure I could also use a queue.

My problem is that I always forget how I do it and always need to search for it when I want to do it again :-) So for you as much as for me here is an example:

# -*- coding: utf-8 -*-

import itertools
from multiprocessing import Pool, Manager

def do_something(arg):
    """ This function does something important in parallel but where we
    want to centralize the output, thus using the queue
    data, myq = arg
    print data

data = range(100)
m = Manager()
q = m.Queue()
p = Pool(5)
p.map(do_something, itertools.product(data, [q]))

with open('output', 'w') as stream:
    while q.qsize():
        print q.qsize()
        item = q.get()
        print item
        stream.write('%s\n' % item)

There are probably other/better ways to do this but that's a start :-)

Tuesday, September 18 2012

Align text in python CLI


A small reminder on how to align text in python

Continue reading...

Monday, June 18 2012

Java JPA and rollback on MySQL


We (b8e5n and I) have been fighting for too long for this, so there it is dear lazy web.

Using the eclipse JPA (Java Persistence API) to connect to a MySQL database you might experienced some troubles.

Using the following piece of code:

transaction = manager.getTransaction();
try {
     // Add here your logic
} finally {
     if (transaction.isActive()) {

We kept running into the fact that the rollback never happened. The commit was performed or at least started and if something was going wrong at the database level (like an already existing primary key), the data already commited to the database would remain in there.

So yay for the half-commited data :-s

It took us a while but we finally ended up finding the solution on a lost corner of the web:

** Please take special note for MySQL database users: do make sure that your tables are InnoDB tables instead of MyISAM. If not, rollback will not occur.

Switching from MyISAM to InnoDB solved the problem for us, the transaction is either fully commited or not at all.

Hope this can help.

Tuesday, March 13 2012

Python notes to self


Small python optimization that I should really follow

Continue reading...

Friday, August 19 2011

Parrallel programming in python


A small example on basic parallel programming in python

Continue reading...

La programmation parallèle avec python


Un petit exemple basique de programmation parrallèle avec python

Continue reading...

Wednesday, August 17 2011

New repoquery


The new version of repoquery can do nice things.

Continue reading...

Une nouvelle version de repoquery


La nouvelle version de repoquery permet de faire des choses amusantes.

Continue reading...

Monday, January 31 2011

A simple pygtk R console


A simple pygtk R console with callback

Une petite interface en pygtk pour R avec affichage des sorties de R dans la fenêtre

Continue reading...

Sunday, April 25 2010

Trackpoint and mouse wheel on Fedora 13

How to configure your trackpoint to emulate mouse wheel on Fedora 13

Comment configurer le troisième bouton de votre trackpoint pour émuler la roulette de la souris sous Fedora 13

Continue reading...

Friday, September 11 2009

Trackpoint et molette de souris

Configurer un trackpoint pour remplacer la molette de la souris

Configure a trackpoint to emulate a mouse wheel

Continue reading...

Saturday, July 25 2009

Chiffrer sa clé usb sous Fedora

How to encrypt an usb key under Fedora

Comment chiffrer sa clé usb sous Fedora

Continue reading...

Saturday, January 5 2008

Regrouper des images

A small trick to merge pictures

Une petite astuce pour regrouper des images en un fichier

Continue reading...