Skip to content

Instantly share code, notes, and snippets.

View jhaubrich's full-sized avatar

Jesse Haubrich jhaubrich

View GitHub Profile
<<<----------------------- MESSAGE RECIEVED: WAAS_PIM3_WAAS_AGC_LOG ------------------>>>
timestamp: 1032900009.7
node_id: 45
node_name: waas_wzlcwrsp2c1
number of entries: 12
CLK Temp Current. 39
CLK Temp Minimum 39
CLK Temp Maximum 39
CLK Temp. Median 39
CLK Power Current. 5.1
@jhaubrich
jhaubrich / gist:4195747
Created December 3, 2012 15:33
subprocess sucks!
def subprocess_sucks():
""" This is what I want to do:
stdout = os.system("\
tail --lines 5000 %s/%s_%s/SP1*rpt\
| grep IDM-GIVE-X2 \
| grep -v Metric \
| tail --lines=39" % (path, month, day))
This is what it looks like:
"""
@jhaubrich
jhaubrich / gist:5032764
Last active December 14, 2015 05:08
Example API call for graphite
# connecting and writting to round robin database today
from socket import socket
CARBON_SERVER = 'modok'
CARBON_PORT = 2003
sock = socket()
try:
sock.connect( (CARBON_SERVER,CARBON_PORT) )
except:
{'site': 'zse'
'wre': 'b'
'waas_second': 1046639304.0
'header': {'current_wre_mode': 5,
'discarded_logs': 0,
'gps_crc': 2548719432,
'lru_status_flag': 0,
'number_of_geo_obs': 3,
'number_of_gps_obs': 11,
'rate_group_type': 2,
@jhaubrich
jhaubrich / reclog_objectifier.py
Last active December 15, 2015 18:39
Help me make this beautiful.
def objectify(frame):
""" yeilds one parsed object defined by the parsers in
the waas library.
"""
log_source = frame['log_type']
parsers = {'SP': sp_log.parse,
'CP': cp_log.parse,
'WAAS': waas_log.parse}
try:
parsed = parsers[ log_source]
print f.recv()
('error.objectifier', {'line': ['NSNS_MAIN.c:8766 15:01:46 04/04/2013 NSNS AIX ',
' I-NS_LOST_MESSAGE "32 lost UDP messages from node id 228 on ring 2"',
'', 'NSNS_MAIN.c:8766 15:01:46 04/04/2013 NSNS AIX ',
' I-NS_LOST_MESSAGE "32 lost UDP messages from node id 229 on ring 2"',
'', 'NSNS_MAIN.c:8766 15:01:46 04/04/2013 NSNS AIX ',
' I-NS_LOST_MESSAGE "31 lost UDP messages from node id 230 on ring 2"',
'', 'NSNS_MAIN.c:8766 15:07:46 04/04/2013 NSNS AIX ',
' I-NS_LOST_MESSAGE "48 lost UDP messages from node id 228 on ring 2"',
'',
error.MON_RDM_SAT_BUMP
{'line': 'DVIM->IMBP 1049650328 MT28 message has expired GEO 135 SV 15 ( 16 ) ',
'site': 'zdc',
'error':
'Traceback (most recent call last):
File "/opt/tools/lib/waas/parsers/sp_log.py", line 86, in _rdm_sat_bump
"cp": int(split_line[6]),
ValueError: invalid literal for int() with base 10: \'GEO\'
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="nanotech"
#ZSH_THEME="pixelplastic"
DISABLE_AUTO_UPDATE="false"
plugins=(git django)
source $ZSH/oh-my-zsh.sh
# source ~/.git-completion.sh
unsetopt correct_all
@jhaubrich
jhaubrich / timeline.coffee
Created May 14, 2013 14:48
Multiline strings in CoffeeScript are AWESOME!
update_plot = (sdate, edate) ->
graphite = "/graphite/render?
&target=alias(summarize(maxSeries(chi2.*.*)%2C'5min'%2C'sum')%2C'')
&format=json
&from=#{sdate/1000}
&until=#{edate/1000}"
@jhaubrich
jhaubrich / gist:5670737
Created May 29, 2013 14:35
Subscribing to a 0MQ feed from any language is simple.
// http://www.zeromq.org/bindings:clr
subscriber.Bind( address: "tcp://GLaDOS:8084" );
subscriber.Subscribe( prefix: "" ); // subscribe to all messages
// Add a handler to the subscriber's OnReceive event
subscriber.OnReceive += () => {