VirtualTam's bookmarks

  1. Context: replace spaces by dashes in a script-generated HTML file's links

    1awk -F\' 'm = /a href/ { gsub(/ /,'-',$2); print$1'\''$2'\''$3} !m {print $0}'
    
  2. Mercurial repository for the W3C Validator :-)

  3. Bigger than my head 2015-03-17

    A friend of mine was once interviewing an engineer for a programming job and asked him a typical interview question:

    • How do you know when a function or method is too big?
    • Well, said the candidate, I don't like any method to be bigger than my head.
    • You mean you can't keep all the details in your head?
    • No, I mean I put my head up against my monitor, and the code shouldn't be bigger than my head.

    ~ from http://www.gigamonkeys.com/book/practical-a-simple-database.html

  4. mkzombie 2015-03-15

    This program creates one or more zombies and a daemon their leader. It can be used to replenish system zombies, or to feed the init monster.

    via http://www.brendangregg.com/specials.html

  5. Python's built-in unittest module is quite cool, but a bit limited and way too verbose (read: it's quite not easy to incite developers to write unit tests)

    I'm currently looking for more dev-friendly solutions, the key points being:

    • writing test code should be easy and straight-forward -keep the focus on "what to test" instead of "how to transcribe a process to a test"
    • parallelization! -we, spoiled developers, should make good use of our way-too-many-cores build machines...
    • complete feature set!
      • we don't want to just run tests...
      • coverage reports (find dead/weak/untested code sections)
      • output formatting (JUnit-XML seems to be quite a common format out there)

    There seem to be 3 solutions in Python:

    • stock unittest + project-dependent customizations / test helpers
    • nosetests
    • py.test

    And 2 ways of gettings things done:

    • keeping things stock: no external dependency, project-specific implementation...
    • using a test framework: one more module in your (test) virtualenv, more concise tests, more features (// run, code coverage, etc.)

    Some links:

  6. To increase the memory allocated and available:

    # /etc/default/jenkins
    JAVA_ARGS="-Xms4G -Xmx16G -Djava.awt.headless=true"
    

    See also

  7. Includes support for Coverage, Xunit and other cool stuff ;-) Oh, and there is parallel testing, too \o/

    nosetests --with-coverage --cover-erase --cover-tests --cover-html --cover-html-dir=htmlcov --with-xunit --xunit-file=unit.xml

    via http://www.alexconrad.org/2011/10/jenkins-and-python.html