Skip to content

Instantly share code, notes, and snippets.

View rsyring's full-sized avatar

Randy Syring rsyring

View GitHub Profile
@rsyring
rsyring / librato-ping.py
Created September 24, 2017 07:09
A python script that pings a host and uploads metrics to Librato
import re
import librato
from sh import ping, hostname
host = 'google.com'
# How many pings should we do before we process the results
ping_for = '30'
# How many times should we ping, process results, and send to Librato
repeat = 2
liberato_token = '<censored>'
@rsyring
rsyring / gist:2787e484b3c3202c654061bf4e4aaef1
Created April 14, 2017 19:24
Troubleshooting zfs snapshot size usage
$ sudo zfs list -r rpool -o name,used,compression,readonly,mounted
NAME USED COMPRESS RDONLY MOUNTED
...
rpool/insig/tmp/playground 6.91M lz4 off yes
$ ls -lh /tmp/playground/
total 512
-rw-rw-r-- 1 rsyring rsyring 2 Apr 14 14:59 foo
# I think snapshot @5 should have more used space.
@rsyring
rsyring / gist:74654ef6b97386354e7377bb350c635f
Created April 5, 2017 17:23
installing scudcloud 1.5 with error message "Depends: python3-pyqt5 but it is not going to be installed"
# See for more context: https://github.com/raelgc/scudcloud/issues/550
rsyring@loftex:~$ sudo apt-get install scudcloud
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
@rsyring
rsyring / random.py
Created April 5, 2017 14:31
random string script using Click library
#!/usr/bin/env python
from __future__ import print_function
import random
import click
@click.command()
@click.argument('length', type=click.INT)
@rsyring
rsyring / keybase.md
Created February 5, 2016 21:41
keybase.md

Keybase proof

I hereby claim:

  • I am rsyring on github.
  • I am randysyring (https://keybase.io/randysyring) on keybase.
  • I have a public key ASAB9i5eth_mEtEPjCuc64rj3P9PEXrohrZe790bJn8yRwo

To claim this, I am signing this object:

@rsyring
rsyring / choosing.html
Last active August 29, 2015 14:21
FreeTDS: choosing a protocol version
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html data-ember-extension="1">
<head>
<title>Choosing a TDS protocol version</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79">
<link rel="HOME" title="FreeTDS User Guide" href="http://www.freetds.org/userguide/index.htm">
<link rel="UP" title="Install FreeTDS" href="http://www.freetds.org/userguide/install.htm">
<link rel="PREVIOUS" title="Install FreeTDS" href="http://www.freetds.org/userguide/install.htm">
<link rel="NEXT" title="servername Lookup" href="http://www.freetds.org/userguide/name.lookup.htm">
@rsyring
rsyring / gist:539797e18eada076bab1
Created July 23, 2014 15:20
autokeyed python dictionary using defaultdict
from collections import defaultdict
def autokeyed_dict():
return defaultdict(autokeyed_dict)
mydict = autokeyed_dict()
mydict['properties']['recent_conversion_event_name']['value'] = 'Test Drive Form'
@rsyring
rsyring / gist:9520549
Created March 13, 2014 01:50
parse python source for comments
def test_noqa_lines(codeString):
g = tokenize.generate_tokens(StringIO(codeString).readline) # tokenize the string
for toknum, tokval, srow, _, _ in g:
if toknum == N_TOKENS:
pass # do something
@rsyring
rsyring / gist:6895791
Created October 9, 2013 03:33
python keyring setup for ubuntu and virtualenvs
import os
from os import path as osp
import sys
import keyring
paths_to_link = (
'/usr/lib/python2.7/dist-packages/dbus',
'/usr/lib/python2.7/dist-packages/_dbus_bindings.so',
'/usr/lib/python2.7/dist-packages/_dbus_glib_bindings.so',