Other articles


  1. Appfirst monitoring

    Quite a long post today I'm afraid !

    Over the last few weeks we've been kicking the tires on the AppFirst monitoring service, and I thought it might be helpful to others to document my thoughts here. I didn't see many such posts when we set out on ...

    read more
  2. Announcing hiera-subnet

    I'd like to announce the availability of hiera-subnet, a new backend i've put together for looking up hiera facts from puppet by using the subnet location of the machine.

    This means that, for instance you may have a fact as one thing for all machines (similar to common ...

    read more
  3. convert kiwibank xml into csv for spreadsheet

    If xml xslt isn't possible, here's a little snippet of code that takes one argument, an xml file as provided by New Zealand's Kiwibank, and converts it into a semi-colon delimited output. Useful for spreadsheets such as libreoffice calc

    Usage: kiwibank-parser.py [xml file path] > output-file.csv ...

    read more
  4. bash progress bar snippet

    little snippet of bash that produces a progress bar

        #!/bin/bash
        # A simple progress bar that overwrites itsself in place

    function print_progress_bar {
        cols=`tput cols`
        jobName="$1"
        doneNum="$2"
        totalNum="$3"
    
        jobLen=${#jobName}
        doneLen=${#doneNum}
        totalLen=${#totalNum}
    
        barLength=$(($cols - ($jobLen+$doneLen+totalLen+14)))
    
        percentDone=`echo "scale=1; ($doneNum/$totalNum)*100 ...
    read more
  5. Move pointer to middle of screen, multi-head.

    Short script (in python) to shift mouse pointer to middle of screen, useful to save time on low acceleration pointing devices. Works for multi-head setups.

    #!/usr/bin/env python
    # Small script to jump pointer to middle of given screen number
    # Run with [scriptname] [screen number]
    import os, sys
    
    modelines = os ...
    read more
  6. Projecting co-ordinates onto a round surface.

    Little snippet of handy code (in perl), how to adjust 2 dimentional latitude / longitude co-ordinates for plotting on a sphere.

        rotAngle = 0;       # Rotational offset
        padX     = 0;       # Initial padding on Y axis
        padY     = 0;       # Initial padding on X axis
    
        posX = 0;
        posY = 0;
    
        posY = 0.5 * log( (1 + sin(lat)) / (1 ...
    read more
  7. ftp auto-banner

    Need to ban people who hammer your ftp, but dont want to or cant install fail2ban ? This may help get you on the right track:

        #!/usr/bin/env python
        import popen2, re, datetime, time, os, sys, logging, syslog

    timeLimit = 300  # in seconds (== 5 minutes)
    failureLimit = 5 # X number of fails ...
    read more
  8. Chord Finder 1.0

    Chord Finder 1.0 is available for general download. I've tried to come up with an rpm format that installs in some sort of a standardised way without breaking too many taboos about file placement. There's a few minor bugs but i'm going to leave it a ...

    read more

blogroll

social