Skip to content

Instantly share code, notes, and snippets.

# tested with hbase 0.19.3 and jython 2.2.1
import java.lang
from org.apache.hadoop.hbase import HBaseConfiguration, HTableDescriptor, HColumnDescriptor, HConstants
from org.apache.hadoop.hbase.client import HBaseAdmin, HTable
from org.apache.hadoop.hbase.io import BatchUpdate, Cell, RowResult
# First get a conf object. This will read in the configuration
# that is out in your hbase-*.xml files such as location of the
# hbase master node.
@andreisavu
andreisavu / check_rps.py
Created June 12, 2009 08:36
Nagios plugin for measuring the peak and average number of requests a server receives.
#! /usr/bin/python
"""
Measure the number of request per seconds the
server has received in the last n requests (peak and average)
You can use it to analyze log files from apache and nginx
or any other server that uses the same log format as apache.
This script is designed to be used as a nagios plug-in.
"""
@andreisavu
andreisavu / ssh-copy-id
Created June 4, 2009 13:39
ssh-copy-id with port parameter. Usage: ssh-copy-id -p 1022 user@server
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
@andreisavu
andreisavu / threadpool.py
Created June 4, 2009 12:30
Python Thread Pool
# Original code at http://code.activestate.com/recipes/203871/
# I have added a limit for the number of tasks waiting
# The method queueTask will block if the current taskList size
# exceeds the specified limit
import threading
from time import sleep
# Ensure booleans exist (not needed for Python 2.2.1 or higher)