Skip to content

Instantly share code, notes, and snippets.

View nikolavp's full-sized avatar

Nikola Petrov nikolavp

View GitHub Profile
@nikolavp
nikolavp / logstash
Last active December 14, 2015 21:38
Logstash script
#! /bin/sh
### BEGIN INIT INFO
# Provides: logstash
### END INIT INFO
# Author: your name here <change email>
#
# Do NOT "set -e"
@nikolavp
nikolavp / mail.py
Created February 25, 2013 15:55
A mail script that can move your mailman mbox files to a mysql table. You can call it with the following: ``` python3 mail.py sourc_file test mailman ``` note that this needs python3!
#!/usr/bin/env python
# vim: set sw=4 sts=4 et foldmethod=indent :
"""mbox_to_mysql: Import messages from mbox files to a mysql database """
# Mbox message handing is being done by mailbox module, which is a python core module.
# However, mbox FILE handling is done internally in this file, because the
# mailbox module does far more than we need, and takes up a lot of time to do it.
#
# Database handling is done through mysql.connector, which is not a core module;
@nikolavp
nikolavp / grok.rb
Created January 16, 2013 13:18
Grok plugin code
@@patterns_path ||= Set.new
if __FILE__ =~ /file:\/.*\.jar!.*/
@@patterns_path += ["#{File.dirname(__FILE__)}/../../patterns/*"]
else
@@patterns_path += ["#{File.dirname(__FILE__)}/../../../patterns/*"]
end
@nikolavp
nikolavp / taskwrapper.sh
Created January 9, 2012 10:53
TaskWarrior wrapper for single id info default command
task(){
if [[ $# -eq '1' ]] && [[ "$1" =~ ^[0-9]+$ ]] ; then
command task $1 info
else
command task $@
fi
}