Skip to content

Instantly share code, notes, and snippets.

@rsff
rsff / preprocessor_fun.h
Last active August 29, 2015 14:27 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
#!/usr/bin/python
import paramiko
import cmd, sys, string, os
import argparse, threading
lock = threading.Lock()
def conn(host,user,cmd):
#!/usr/bin/python
#this script can NEVER FAIL!
'''
script to retrieve jmx related to metrics and send them to zabbix
'''
import subprocess
import re
import sys
@rsff
rsff / drilldo.py
Last active March 28, 2021 11:53
stash pooler
#this script can NEVER FAIL!
'''
This escripte will query zabbix for webscenarios, find out their ID and get the
status of itafterward will update the stashboard
KKTHXBYE
'''
@rsff
rsff / go2gray
Created March 19, 2015 12:55
send data to graylog testing GELF
import json
import urllib2
import socket
graydata = json.loads(open('/tmp/json.out').read())
val = graydata['general']
val["short_message"] = socket.gethostname()+ " access statistics"+" from "+val["log_file"]
val["host"] = socket.gethostname()
json_data = json.dumps(val)
@rsff
rsff / gist:067cfdad9e1e858da863
Created March 18, 2015 12:23
jolokia to d3 extractor
#!/usr/bin/python
'''
get jolokia data and write a csv in a folder so it can be
processed by the d3
'''
from pyjolokia import Jolokia
__author__ = "Ricardo Ferreira"
@rsff
rsff / testme
Created March 12, 2015 12:24
Test meta extractor
>>> print user_metadata
{u'X-Object-Meta-Me': u'wrote this', 'X-Object-Meta-LOL': 'foobar'}
>>> print sys_metadata
{u'X-Object-Sysmeta-Stuff': u'system stuff'}
user_metadata = {}
sys_metadata = {}
for key, value in metadata.iteritems():
if is_user_meta('Object',key):
@rsff
rsff / gist:7f39d58018823e060b55
Created October 16, 2014 16:35
openWRT tplink 941nd v3
config wifi-device 'radio0'
option type 'mac80211'
option channel '3'
option hwmode '11ng'
option path 'platform/ar934x_wmac'
list ht_capab 'LDPC'
list ht_capab 'DSSS_CCK-40'
list ht_capab 'SHORT-GI-40'
list ht_capab 'TX-STBC'
list ht_capab 'RX-STBC1'
@rsff
rsff / WSO2parser.py
Created October 16, 2014 16:32
WSO2 stats parser
import subprocess
import re
USER = 'admin'
PASSWD = 'admin'
PORT = '9999'
HOST = ''
JMXSH = '/home/rsff/Theorem/jmxsh.jar'
@rsff
rsff / ssh_agent_start.fish
Last active March 14, 2019 08:56 — forked from schaary/ssh_agent_start.fish
ssh agent for fish
#this script can never fail
#i use it in the fish_config
#call it with start_agent
setenv SSH_ENV $HOME/.ssh/environment
function start_agent
if [ -n "$SSH_AGENT_PID" ]
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null