Skip to content

Instantly share code, notes, and snippets.

View jhavard's full-sized avatar

John Havard jhavard

View GitHub Profile
@jhavard
jhavard / gsm.py
Last active December 6, 2015 09:30
Decoder for WSR-88D General Status Message
import struct
BLOCK_DIVIDER = 10
LENGTH_OF_BLOCK = 11
MODE_OF_OPERATION = 12
VCP = 14
ELEVATION_CUTS = 15
ELEVATION_01 = 16
ELEVATION_02 = 17
ELEVATION_03 = 18
@jhavard
jhavard / httpd.conf
Created January 4, 2016 18:28
Stupid simple web interface to AWIPS fxatext database
# snippet from httpd.conf, borrowed from wordpress .htaccess
# because I didn't feel like thinking about rewrite rules
<Location "/text">
RewriteEngine On
RewriteBase /
RewriteRule ^text\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /text.php [L]
@jhavard
jhavard / mon300.py
Last active February 14, 2016 01:37
Novra S300N Status Monitor
#!/awips2/python/bin/python
# This software is released into the public domain.
# If your jurisdiction does not recognize works
# released into the public domain, then this work
# is freely available to anyone for any reason,
# even if the original author finds that use
# morally abhorrent.
import s300
@jhavard
jhavard / README
Last active February 17, 2016 21:29
Novra S300N Status Graphs
This is a quick and dirty script to grab the xml status from the Novra 'cmcs' utility,
grab the items we care about, add those to an rrd file, and then generate graphs. Not
really concerned with much more than the past day, but I made the rrd database large
enough to give a decade's worth of data to the 15 minute mark (I think). Since I can
never remember how to generate an rrd file, I googled for some little online thing
that will help. Take a look at http://rrdwizard.appspot.com/ if you are in the same boat.
This entire thing is probably wrong, but it works, so close enough.
rrdtool create satellite.rrd --step '60' \
@jhavard
jhavard / scalomatic.sh
Last active December 6, 2016 00:19
quick little script to deal with image thumbnailing I need for a little project
#!/bin/bash
# The idea is to create the files in the same directory as the source image in a variety of image sizes
# as used by this particular template I am using.
SIZES="100x100 1132x411 1132x868 150x115 150x150 238x182 337x258 426x327 536x391 536x411 860x662 983x755"
for X in $SIZES ; do
DIR=`dirname $1`
FILE=`basename $1`
echo convert $1 -resize "${X}^" -gravity center -crop ${X}+0+0 +repage ${DIR}/scaled_${X}_${FILE}
@jhavard
jhavard / matcher.py
Last active June 7, 2018 18:09
Matches list of powerball numbers against the powerball.com published numbers
#!/usr/bin/python
# note that this will no longer work since they changed the API location
# and I really don't care enough about this to update the script. Sorry!
import httplib
import json
conn = httplib.HTTPSConnection('www.powerball.com')
@jhavard
jhavard / iv_feed_printer.py
Last active May 12, 2021 17:32
Prints USPS Informed Visibility data stored in mongodb, previous version used the raw json files
#!/usr/bin/python3
# Now uses MongoDB
import os
import pathlib
import pprint
import json
import texttable
@jhavard
jhavard / effwon.py
Created August 8, 2018 05:53
takes a telegram as specified in ITU-T Recommendations F.1 and F.31 and turns into an object
class Effwon:
def __init__(self, message):
self.msg = message
self.split()
self.words = self.bodycount() + self.addrcount()
self.headerparse()
self._stringify_blocks()
def split(self):
@jhavard
jhavard / reader.py
Created April 18, 2019 05:02
shared memory fun in python
import ntxop.smem as smem
TACOS = (0, 32, smem._STR)
FOO = (32, 48, smem._INT)
BAR = (48, 65584, smem._PKL)
QUUX = (65584, 65600, smem._STR)
mm = smem.SmemFile('/mangos', 'r')