Skip to content

Instantly share code, notes, and snippets.

View linuxkidd's full-sized avatar

Michael J. Kidd linuxkidd

View GitHub Profile
@linuxkidd
linuxkidd / hotp.py.patch
Created August 3, 2016 20:41
Patch to the wari hotp.py file to output PIN or Secret+PIN to stdout -- useful for piping into programs
--- /usr/lib/python2.7/site-packages/wari-0.0.1-py2.7.egg/wari/hotp.py.orig 2016-08-03 13:38:00.601784735 -0700
+++ /usr/lib/python2.7/site-packages/wari-0.0.1-py2.7.egg/wari/hotp.py 2016-08-03 13:38:30.758031752 -0700
@@ -105,11 +105,13 @@
pin = otp.get_hotp(b32, intervals_no=step)
password = "%s%s" % (document['secret'], pin)
if 'pin' in items:
- pyperclip.copy(pin)
- logger.info('pin copied to the clipboard')
+ print str(pin)
+ pyperclip.copy(str(pin))
@linuxkidd
linuxkidd / map_events_to_buckets.sh
Created August 12, 2016 16:17
Run this with 'ceph.log' and 'ceph osd tree' output files to align Slow requests (primary, secondary and total), failed events, boot events and 'wrongly marked me down' events to OSDs and their leaf
#!/bin/bash
if [ -z $2 ]; then
echo
echo "Usage: $(basename $0) <ceph.log> <osd-tree>"
echo
exit 1
fi
if [ ! -e $1 ]; then
@linuxkidd
linuxkidd / map_reporters_to_buckets.sh
Created August 12, 2016 18:57
Provide ceph-mon log and a 'ceph osd tree' output to map 'reported failed' events (reporter and reported) to their buckets.
#!/bin/bash
if [ -z $2 ]; then
echo
echo "Usage: $(basename $0) <ceph-mon.log> <osd-tree>"
echo
exit 1
fi
if [ ! -e $1 ]; then
@linuxkidd
linuxkidd / ceph_pg_stats.py
Created September 30, 2016 18:02
Output interesting statistics from 'ceph report'
#!/usr/bin/env python
import sys
import math
import simplejson as json
obj=json.load(sys.stdin)
def format_kbytes(b):

Keybase proof

I hereby claim:

  • I am linuxkidd on github.
  • I am linuxkidd (https://keybase.io/linuxkidd) on keybase.
  • I have a public key ASAP-j5cVdvJ99MHAIjO-LVDBCcHS2E6vhyd4ScnQyTUqAo

To claim this, I am signing this object:

@linuxkidd
linuxkidd / iostat_util_histo.awk
Created July 16, 2018 19:37
Given output of 'iostat -x 1', provides a time spent by Utilization in 10% Util buckets
#!/usr/bin/awk -f
BEGIN {
}
function histoevent(mykey,myevent,myfunc,myvalue) {
EVENTHEADERS[myevent]=1
if(myfunc=="sum")
EVENTCOUNT[mykey][myevent]+=myvalue
#!/usr/bin/env python
import sys
import simplejson as json
obj=json.load(sys.stdin)
itemcount=0
sizesum=0
accountsizesum=0
#!/usr/bin/awk -f
##
## Usage:
## cat orig.bi.list | ./import_bi_list.awk -v bucketname=mybucket -v bucketid=mybucketid -v marker=mymarker -v poolname=myrgw.buckets.data -v namesfile=diffnamesfile
##
##
function procObj() {
if(mynames[objname]) {
#!/usr/bin/env python
import sys,os,datetime
import simplejson as json
from subprocess import Popen, PIPE
from StringIO import StringIO
"""NOTE: Please ensure the 'CEPH_ARGS' environment variable is set for any cluster specific options required on radosgw-admin commands"""
cephargs=""
#!/bin/bash
if [ -z "$2" ]; then
echo Please provide OSD data partition and Journal partitions
echo
echo Usage:
echo ./$0 /dev/sde1 /dev/sdb1
echo
exit 1
fi