Skip to content

Instantly share code, notes, and snippets.

@marcelom
marcelom / pysyslog.py
Created December 5, 2012 18:06
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'
@marcelom
marcelom / printerwho.py
Created March 14, 2013 19:48
Print Server Log Analyser (for Windows)
# This script takes a windows CSV export of the log file from a windows server machines
# and looks for print jobs.
# It then adds them to a disctionary of dictionaries of sets. First level is the date,
# second is the user, third is the set of printers.
# Then it exports them as a CSV.
import re
import sys
import csv
@marcelom
marcelom / myshuffle.go
Created June 7, 2013 21:09
Go Slice Shuffle
package main
import (
"fmt"
"math/rand"
"time"
)
func Shuffle(a []int) {
for i := range a {
@marcelom
marcelom / smugget1.3.sh
Created November 13, 2013 07:18
Smugget v1.3
#!/bin/bash
# Original by http://braindump.dk/tech/2007/10/03/smugmug-uploader/
# Modified by Jesse DeFer http://www.dotd.com/smugget/
# Additional modifications by Robert Krawitz
# Downloads SmugMug albums
function download_image
{
echo "Downloading $albumid/$filename ($md5sum)"
if [ $LOG -eq 1 ]; then
@marcelom
marcelom / tail.py
Created October 7, 2016 18:37
MMAP'ed tail in python
# Quick & Dirty... Full of bugs... Dont use for production code... You have been warned... ;-)
import mmap
import os
NUM_LINES=10
f=open('.bash_history', 'rb')
filesize = os.fstat(f.fileno()).st_size