This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
if (!defined($ARGV[0]) or ! -d $ARGV[0]) { | |
print "Supply a valid path\n"; | |
} | |
opendir(THEDIR,$ARGV[0]); | |
my $counter = 0; | |
while (my $file = readdir(THEDIR)) { | |
$counter++; | |
} | |
closedir(THEDIR); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Filesystem(object): | |
# Represents a Filesystem, with convenience methods to generate the mount command | |
BLANK=0x0 | |
FAT16=0x4 | |
NTFS=0x7 | |
EXT=0x83 | |
LVM=0x8e | |
FAT32=0xb | |
SWAP=0x82 | |
VMFS=0xfb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# SERVICES is a space-separated list of services to reload | |
# FILES is a list of configuration files to propagate from localhost to $HOSTS | |
# HOSTS is a list of servers to propagate things to. | |
# | |
# Assumes that some kind of passwordless SSH is already setup. | |
RELOADSERVICES="" | |
RESTARTSERVICES="varnish" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JH Lock Test - 20110902 | |
// I've used this in the past to debug locking issues (NFS) | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <fcntl.h> | |
char * filename; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# @(#) generate-rfc4193-addr.sh (ULA) (c) Sep 2004 - Jun 2011 Holger Zuleger | |
# | |
# do what the name suggest | |
# | |
# firstpart = 64-Bit NTP time | |
# secondpart = EUI-64 Identifier or 48 Bit MAC-Adress | |
# sha1sum ($firstpart | $secondpart ) | |
# use least significant 40 Bits of sha1sum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# script to backup MySQL data to remote server | |
# James Hannah - January 2009 | |
# set some variables | |
FILENAME="`date +mysqldump-%Y-%m-%d-%H:%M:%S`.sql" | |
LOCALFILE="/home/sql_backup/$FILENAME" | |
LOCKFILE="/tmp/sqlbackup.lock" | |
BACKUPSERVER="10.1.1.1" | |
MYSQLPASS="secretsgohere" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tool for debugging syslog problems, prints logs to stdout with ansi colours | |
# This version summarises the way that cookies are distributed between incoming servers/backends | |
import socket | |
import re | |
import time | |
tstart = time.time() | |
host='localhost' | |
port=514 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/sh | |
# Rsync driver script | |
# James Hannah <james at tlyk dot eu> | |
# PID file name | |
PIDFILE=/var/run/rsyncd-thing.pid | |
# check that its not already running | |
if [ -f $PIDFILE ]; then | |
OLDPID=`cat $PIDFILE` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# scans a single document and mails it | |
# | |
# Requirements: sane, ImageMagick, tesseract, gocr, sendemail | |
# It would be trivially email to remove gocr, tesseract is better it seems | |
# You could replace ImageMagick with anything that convert PBM > something. | |
SCANFILE=`mktemp /tmp/scantmp.XXXXXXXX` | |
PBMFILE="${SCANFILE}.pbm" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# | |
# Goes through an mbox (filename given in argv[1]) and | |
# purges messages older than thirty days. | |
# (and newer than year 3000 to pick up corrupt headers) | |
# | |
import sys | |
import platform | |
try: | |
pv = platform.python_version_tuple() |