Skip to content

Instantly share code, notes, and snippets.

@jehiah
jehiah / keybase.md
Created August 13, 2014 20:11
keybase.md

Keybase proof

I hereby claim:

  • I am jehiah on github.
  • I am jehiah (https://keybase.io/jehiah) on keybase.
  • I have a public key whose fingerprint is 5FA8 C7EF F19D F9BB 8B02 18AA 43CA 3BC5 5BBC 543F

To claim this, I am signing this object:

@jehiah
jehiah / bulk_shorten_links.go
Created June 13, 2014 15:47
Encode a bulk csv of links against the Bitly API
@jehiah
jehiah / gist:a93ceab1dd4d9c431653
Created June 5, 2014 18:09
clickatron uptime
$ sudo svstat /service/clickatron_sortdb-1
/service/clickatron_sortdb-1: up (pid 4235) 87771717 seconds
$ uptime
18:08:07 up 1073 days, 23:49, 1 user, load average: 1.02, 1.18, 1.22
@jehiah
jehiah / hash_file.go
Created May 23, 2014 16:03
Utility for hashing the records of a file
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/csv"
"flag"
"fmt"
"log"
"os"
@jehiah
jehiah / notify.sh
Created January 19, 2014 21:45
email notify at system boot time
#!/bin/bash
#
# *************************************************
# chkconfig: 2345 99 99
# description: notify email address on system boot.
# *************************************************
# Installing:
# 1) save as /etc/rc.d/init.d/notify
# 2) set the desired email address in "MAILADD" variable
# 3) chmod a+w /etc/rc.d/init.d/notify
@jehiah
jehiah / check_swap_paging_rate.sh
Created January 19, 2014 21:37
Nagios Monitor for the rate pages are swapped in/out
#!/bin/bash
# Show the rate of swapping (in number of pages) between executions
OK=0
WARNING=1
CRITICAL=2
UNKNOWN=-1
EXITFLAG=$OK
WARN_THRESHOLD=1
@jehiah
jehiah / check_forkrate.sh
Created January 19, 2014 21:32
check_forkrate.sh script to monitor system fork rate with nagios
#!/bin/bash
# Copyright bitly, Aug 2011
# written by Jehiah Czebotar
DATAFILE="/var/tmp/nagios_check_forkrate.dat"
VALID_INTERVAL=600
OK=0
WARNING=1
CRITICAL=2
@jehiah
jehiah / nsq_to_nsq.py
Created August 14, 2013 18:09
relay messages from NSQ to NSQ via TCP protocol
import tornado.options
from nsq import Reader, run
from nsq import Writer, Error
import functools
import logging
from host_pool import HostPool
class NSQProxy:
def __init__(self, topic, nsqds):
self.topic = topic
@jehiah
jehiah / BufferedMessageHandler.py
Created July 15, 2013 02:05
Buffered NSQ reader (python)
import tornado.ioloop
import logging
import time
class BufferedMessageHandler(object):
"""
Usage:
buffered_handler = BufferedMessageHandler(my_handler)
r = Reader(message_handler=buffered_handler)
@jehiah
jehiah / update_github_hipchat_hook.py
Created January 15, 2013 03:21
This is a script that updates hipchat hooks on a github repository to only have a small set of actions they trigger based on (ie: push, issues).
#!/usr/bin/env python
"""
This is a script that updates hipchat hooks on github repository to only have a small set of actions they trigger based on.
created by Jehiah Czebotar 2013
Usage:
update_github_hipchat_hook.py --repo=jehiah/json2csv --access_token={{...}}
"""