Skip to content

Instantly share code, notes, and snippets.

View stemid's full-sized avatar

Stefan Midjich stemid

View GitHub Profile
@stemid
stemid / gnuplot.gnu
Last active August 29, 2015 14:20
Gnuplot script to plot TIMING-SA values from amavis maillogs
#!/usr/bin/env gnuplot
# Extract the values into a csv, I tend to save only hour:minutes:seconds and the milliseconds using awk
# Example: grep TIMING-SA /var/log/maillog | awk '{printf "%s,%s\n", $3, $11}'
#
# Then set the csv filename in envrionment before running script.
# export GNUPLOT_NAME=sa_timing.csv
# ./gnuplot.gnu
reset
@stemid
stemid / days_in_month.py
Last active August 29, 2015 14:10
calculates days of each month with a simple formula thought up by Curtis McEnroe
#!/usr/bin/env python
# http://cmcenroe.me/2014/12/05/days-in-month-formula.html
from __future__ import print_function
from argparse import ArgumentParser
import math
parser = ArgumentParser()
parser.add_argument(
# Example: sudo tail -F /var/log/maillog|grep -E '(stat=|CLEAN|Blocked SPAM)'|colout -T ~/.colout -t maillog
# By Stefan Midjich
def theme():
bright_black = '#002b36'
black = '#073642'
bright_green = '#586e75'
bright_yellow = '#657b83'
bright_blue = '#839496'
bright_cyan = '#93a1a1'
@stemid
stemid / colout_df.py
Last active December 18, 2015 05:39
Dwarf Fortress gamelog Colout theme for Solarized terminals.
# Colout Dwarf Fortress theme for Solarized terminals
# First install colout, go to https://github.com/nojhan/colout
#
# mkdir ~/.colout
# cp colout_df.py ~/.colout/
# tail -0f df/gamelog.txt | colout -T ~/.colout -t df
#
# I just started this for my own sake, please do add your own colors, regexes and stuff.
# By Stefan Midjich
@stemid
stemid / brew.py
Created July 24, 2012 14:07
Homebrew module for ansible
#!/usr/bin/python -tt
# (c) 2012, Stefan Midjich
# Written by Stefan Midjich <swehack@gmail.com>
#
# This module was written for Ansible.
# It doesn't support all of Homebrew yet.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@stemid
stemid / sex.c
Last active January 13, 2024 11:49
/*sex.c*/
/* Original author unknown. Presumably this is public domain by now.
* If you are the original author or know the original author, please
* contact <freebsd@spatula.net>
*
* Orphan code cleaned up a bit by Nick Johnson <freebsd@spatula.net>
* Completely rewrote how word wrapping works and added -w flag.
*/