Schatten Licht

Python

Read your python module documentation from emacs

I just found the excellent pydoc-info mode for emacs from Jon Waltman. It allows me to hit C-h S in a python file and enter a module name to see the documentation right away. If the point is on a symbol (=module or class or function), I can just hit enter to see its docs.

pydoc in action

def censor_the_net_2012()

def censor_the_net():
  try: SOPA() # see Stop Online Piracy Act 
  except Protest: # see sopastrike.com 
    try: PIPA() # see PROTECT IP Act 
    except Protest: # see weak links 
      try: OPEN() # see red herring 
      except Protest: 
        try: ACTA() # see Anti-Counterfeiting_Trade_Agreement 
        except Protest: # see resignation⁽¹⁾, court, vote anyway and advise against
          try: CISPA() # see Stop the Online Spying Bill 
          except Protest: # see Dangers
            do_it_anyway() # destroy free speech and computers (english video).
while wealth_breeds_wealth and wealth_gives_power: # (german text and english video) censor_the_net() # see wealth vs. democracy (german)

pyRad is now in Gentoo portage! *happy*

My wheel type command interface pyRad just got included in the official Gentoo portage-tree!

So now you can install it in Gentoo with a simple emerge kde-misc/pyrad.

pyRad command wheel

turn files with wikipedia syntax to html (simple python script using mediawiki api)

I needed to convert a huge batch of mediawiki-files to html (had a 2010-03 copy of the now dead limewire wiki lying around). With a tip from RoanKattouw in #mediawiki@freenode.net I created a simple python script to convert arbitrary files from mediawiki syntax to html.

Usage:

  • Download the script and install the dependencies (yaml and python 3).
  • ./parse_wikipedia_files_to_html.py <files>

pyRad - a wheel type command interface for KDE

pyRad is a wheel type command interface for KDE1, designed to appear below your mouse pointer at a gesture.

install | setup | usage and screenshots | download and sources

pyRad command wheel


  1. powered by KDE 

pkgcore vs. eix → pix (find packages in Gentoo)

For a long time it bugged me, that eix uses a seperate database which I need to keep up to date. But no longer: With pkgcore as fast as it is today, I set up pquery to replace eix.

The result is pix:

alias pix='pquery --raw -nv --attr=keywords'

(put the above in your ~/.bashrc)

The output looks like this:

$ pix pkgcore
 * sys-apps/pkgcore
    versions: 0.5.11.6 0.5.11.7
    installed: 0.5.11.7
    repo: gentoo
    description: pkgcore package manager
    homepage: http://www.pkgcore.org
    keywords: ~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86

Spiele programmieren (Quellen)

Das hier ist eine kleine Auswahl an Quellen, um eigene Spiele zu programmieren. Sie ist nicht vollständig, sollte aber ausreichen, um direkt anfangen zu können. Sie enthält nur freie Programme.

Wenn du C++ programmieren kannst

Wenn du Python programmieren kannst

Wenn du nicht programmieren kannst

Mercurial vs. Bazaar speedtest clone and log - update: 4 runs with different versions

Some folks in #mercurial @ freenode.net just repeated the tests, so we have now a bit more stable data.

The evaluation shows the following:

  1. Initial clone: hg is about 4.4 times faster (about 2 min vs. 6 to 15 min)
  2. Repository sizes: the hg repo is about 1.92 smaller (~113M vs. 215M)
  3. Time for a full log: hg is about 2.36 times faster (~21s vs. ~50s)
  4. Time for annotating Misc/NEWS: hg is 1.5 times slower than bzr.
    Without the result from bzr-1.6.1 it is 2.6 times slower (~43s vs 17s).
  5. Integrity checking: hg is by several orders of magnitude faster than bzr which just took too long - everyone stopped it after varying time (30s to 17 min), because the output spoke of hours remaining, one had an integrity error. hg needed about 1 min.
  6. Local clone: hg is 11 times faster (39s vs. 7.14 min).
    Without the 1m15 result from the high disk load host it is 16 times faster (26s).
  7. Local clone with hot filesystem: hg is 14.9 times faster (26s vs. 6.5 min).
  8. Hot copy of just .bzr / .hg: The speeds are about equal, so the difference doesn't come from raw filesystem speed (2s).
  9. Additional Bazaar tests to check shared repository cloning performance (you only get this when you use a shared repository and only clone that shared repository): With shared repository and hardlinks bzr only needs about 5 seconds for cloning.

Geschwindigkeitstest - zwei Arten des for loops über tuples

Ich habe getestet, ob es einen Geschwindigkeitsunterschied zwischen zwei Arten des for loops über eine Liste von tuples gibt:

liste_von_tuples = [(1, 2), (3, 4), (5, 6)]

Es gibt 100.000 tuple, und jeder tuple enthält 2 Zufallszahlen.

Art 1:

for i in liste_von_tuples: 
   res.append(i[1])

Art 2:

for i, j in liste_von_tuples: 
   res.append(j)

Versionsverwaltungen testen - Mercurial (hg) und Bazaar (bzr)

Ich habe gerade einen sehr schönen Vergleich der Versionsverwaltungssysteme Mercurial und Bazaar gefunden.

Für alle, die sich nicht durch einen langen Artikel wühlen wolllen:

Mercurial ist in den meisten Tests 2-5x schneller als Bazaar.

Der volle Artikel:

http://sayspy.blogspot.com/2006/11/bazaar-vs-mercurial-unscientific.html

Falls ihr gerne eine Übersetzung der kritischen Teile hättet, schreibt es bitte.

Inhalt abgleichen


 
 
 
Diese Seite nutzt Drupal.
Design: Arne Babenhauserheide.

Werke von Arne Babenhauserheide.
Lizensiert unter freien Lizenzen.

Valid XHTML 1.0 Strict