Skip to content

Instantly share code, notes, and snippets.

View linuxkidd's full-sized avatar

Michael J. Kidd linuxkidd

View GitHub Profile
#!/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
import simplejson as json
obj=json.load(sys.stdin)
itemcount=0
sizesum=0
accountsizesum=0
@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

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 / 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):
@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 / 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 / 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_slow_requests_to_buckets.sh
Last active August 12, 2016 16:19
Provided a ceph.log and ceph osd tree output, this script generates a CSV mapping any 'slow request' entries to their appropriate buckets for identifying common hardware to the slow requests.
#!/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 / led_color.py
Created January 29, 2016 02:03
Python code to change the color on WiFi RGB LED controller
#!/usr/bin/python
import sys
import socket
def Main(host,color):
port = 5577
s = socket.socket()
s.connect((host, port))