Skip to content

Instantly share code, notes, and snippets.

View PaulReiber's full-sized avatar
💭
Inevitable

Paul Reiber PaulReiber

💭
Inevitable
View GitHub Profile
@PaulReiber
PaulReiber / start.py
Created November 20, 2019 03:35
Starting point for a python command
"""
Script to DO SOMETHING. Starting point.
"""
import argparse
import logging
def logger(log_level):
logging.getLogger(__name__).setLevel(log_level)
def arguments():
@PaulReiber
PaulReiber / roll.py
Last active November 18, 2019 22:27
quick example code - d&d dice roll in python
from random import randint as rand
def roll(**dice):
ret=0
for key in dice:
val = rand(1, dice[key])
print("%s: %s" % (key, val))
ret += val
return(ret)
@PaulReiber
PaulReiber / caliquakes.py
Created May 4, 2018 21:37
earthquake feed json parser in python3.6
########################################################
# caliquakes.py - list CA quakes in past week
# Author: Paul Reiber
#
import json
import datetime
import urllib.request
import pprint
feed = "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_week.geojson"
@PaulReiber
PaulReiber / findBiggest.py
Last active May 4, 2018 22:33
version number scanning
#################################################
# determine newest/largest versionstring
# embedded in the filenames in a given directory
# Author: Paul Reiber
import re
import os
import sys
import pprint
from distutils.version import LooseVersion

Keybase proof

I hereby claim:

  • I am PaulReiber on github.
  • I am paulreiber (https://keybase.io/paulreiber) on keybase.
  • I have a public key whose fingerprint is 8FE1 6B51 BF58 1433 1808 C33A FCC1 4201 B3F5 BC4E

To claim this, I am signing this object:

@PaulReiber
PaulReiber / groupwords.py
Last active May 14, 2019 19:53
linux pipeline filter that groups together related words, generating output that's ready for additional processing
# -*- coding: utf-8 -*-
""" groupwords - a text filter to group words by their letters
Author: Paul Reiber reiber@gmail.com
License: CC BY-SA 4.0
Date: 2016-10-15
unlike most Linux text processing tools
this program must consume stdin entirely
before it can emit its output.
@PaulReiber
PaulReiber / anagrammer.py
Last active May 14, 2019 19:51
Anagram scanner
# -*- coding: utf-8 -*-
""" anagrammer - leveraging collections.Counter and pythons base classes
Author: Paul Reiber reiber@gmail.com
License: CC BY-SA 4.0
input is a dictionary - a list of words with each word listed on exactly once.
output is any anagrams collected which are as big or bigger than their words are long.
output limited to anagrams larger than 4
@PaulReiber
PaulReiber / iomon.py
Last active September 28, 2016 22:44
server io monitoring for Linux in Python
###############################################################################
#
# iomon.py - a simple server io monitor for Linux, in Python, by Paul Reiber
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@PaulReiber
PaulReiber / pyld.py
Last active August 24, 2016 20:33
Python-based re-implementation of LogDissector.awk
################################################################################
#
# pyld - a python-based derivative of logdissector.awk
#
# Author: Paul Reiber paul@reiber.org
# License: CC BY-SA 4.0
#
# pyld generates derivative data about its input data
# which is often quite useful and revealing.
#
@PaulReiber
PaulReiber / collect
Created November 20, 2014 15:58
Collect command outputs from all nodes in a cloud
#!/bin/bash
#
# setup: to populate all-nodes file on a fuel master, run this once in a while:
# fuel node|awk '/ready/ {print "node-" $1}'|sort >all-nodes
# otherwise, put a list of hostnames on separate lines in all-nodes
#
# usage:
# collect <args>
#
# runs <args> on all nodes, collecting output into a nicely named file in