Skip to content

Instantly share code, notes, and snippets.

View nikolavp's full-sized avatar

Nikola Petrov nikolavp

View GitHub Profile
@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
}
@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 / 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 / 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 / gist:5488026
Created April 30, 2013 10:59
Cassandra upstart job
description "Cassandra is a distributed (peer-to-peer) system for the management and storage of structured data."
author "nikola.petrov@ontotext.com"
start on filesystem
stop on runlevel[016]
@nikolavp
nikolavp / build-graphite-deb.sh
Created June 11, 2013 09:18
Bulding graphite packages with FPM. Note that there are no dependencies in the metadata for the packages at the moment
echo Installing dependencies
apt-get -y install python apache2 python-twisted python-memcache libapache2-mod-python python-django libpixman-1-0 python-cairo python-django-tagging
echo Downloading packages
wget http://pypi.python.org/packages/source/c/carbon/carbon-0.9.10.tar.gz#md5=1d85d91fe220ec69c0db3037359b691a
wget http://pypi.python.org/packages/source/w/whisper/whisper-0.9.10.tar.gz#md5=218aadafcc0a606f269b1b91b42bde3f
wget http://pypi.python.org/packages/source/g/graphite-web/graphite-web-0.9.10.tar.gz#md5=b6d743a254d208874ceeff0a53e825c1
echo Unarchiving packages
tar zxf graphite-web-0.9.10.tar.gz
tar zxf carbon-0.9.10.tar.gz
ERROR 12:16:06,315 error writing to <IP>
java.lang.RuntimeException: java.io.IOException: Broken pipe
at org.apache.cassandra.db.ColumnSerializer.serialize(ColumnSerializer.java:59)
at org.apache.cassandra.db.ColumnSerializer.serialize(ColumnSerializer.java:30)
at org.apache.cassandra.db.ColumnFamilySerializer.serialize(ColumnFamilySerializer.java:73)
at org.apache.cassandra.db.Row$RowSerializer.serialize(Row.java:62)
at org.apache.cassandra.db.ReadResponseSerializer.serialize(ReadResponse.java:78)
at org.apache.cassandra.db.ReadResponseSerializer.serialize(ReadResponse.java:69)
at org.apache.cassandra.net.MessageOut.serialize(MessageOut.java:131)
at org.apache.cassandra.net.OutboundTcpConnection.write(OutboundTcpConnection.java:221)
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
# Add files and commands to this file, like the example:
# watch(%r{file/path}) { `command(s)` }
#
guard 'shell' do
watch(/(.*).tex/) {|m| `make` }
end
avg-cpu: %user %nice %system %iowait %steal %idle
15.58 0.08 0.76 35.94 0.00 47.65
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 17.54 8.82 101.43 3.97 5221.16 1138.41 120.68 0.13 9.42 6.25 90.36 7.85 82.78
md0 0.00 0.00 0.43 0.47 1.72 1.89 8.00 0.00 0.00 0.00 0.00 0.00 0.00
md2 0.00 0.00 119.05 11.97 5219.44 1135.15 97.00 0.00 0.00 0.00 0.00 0.00 0.00
md1 0.00 0.00 0.00 0.00 0.00 0.00 2.66 0.00 0.00 0.00 0.00 0.00 0.00
<VirtualHost *:9000>
ServerName <our-hostname>
DocumentRoot /opt/Kibana/public
<Directory /opt/Kibana/public/>
Deny from all
Allow from <our-ip>
Options -MultiViews
</Directory>
</VirtualHost>