Skip to content

Instantly share code, notes, and snippets.

View wjimenez5271's full-sized avatar

William Jimenez wjimenez5271

  • San Jose, CA
  • 09:17 (UTC -07:00)
View GitHub Profile
@wjimenez5271
wjimenez5271 / setup-riemann.sh
Created July 20, 2012 17:41
setup riemann tools
yum install -y ruby rubygems make gcc gcc-c++ ruby-devel
gem install riemann-tools
nohup riemann-health --host 192.168.10.100&
apt-get -y install ruby rubygems make gcc g++ ruby-dev
gem install riemann-tools
nohup /var/lib/gems/1.8/bin/riemann-health --host 192.168.10.100&
exit
require 'riemann/client'
c = Riemann::Client.new host: 'euca-riemann', port: 5555
#find out my hostname
host = %x[hostname]
#first determine how many instances I have according to libvirt
kvm_instances = %x[virsh list |grep i-|wc -l]
require File.expand_path('../../lib/riemann/tools', __FILE__)
class Riemann::Tools::KVM
include Riemann::Tools
def tick
#determine how many instances I have according to libvirt
kvm_instances = %x[virsh list |grep i-|wc -l]
#!/usr/bin/env ruby
require File.expand_path('../../lib/riemann/tools', __FILE__)
class Riemann::Tools::KVM
include Riemann::Tools
def tick
#determine how many instances I have according to libvirt
@wjimenez5271
wjimenez5271 / gist:8230340
Created January 3, 2014 00:43
pig_latin_translate.py
#define the suffix we'll use in pig latin
pyg = 'ay'
#ask for input of the word to translate
original = raw_input('Enter a word:')
#santize input and check to see if word starts with a vowel or consonant
if len(original) > 0 and original.isalpha():
original = original.lower()
print "you entered: " + original
May 27, 2014 2:07:13 PM jenkins.plugins.hipchat.StandardHipChatService publish
WARNING: Error posting to HipChat
java.net.UnknownHostException: https
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:407)
at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88)
at hudson.util.NoClientBindSSLProtocolSocketFactory.createSocket(NoClientBindSSLProtocolSocketFactory.java:135)
@wjimenez5271
wjimenez5271 / gist:74df2b16b540a7d9de0c
Created May 29, 2014 17:04
haproxy stats parsing
['']
index: 0
pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,
['pxname', 'svname', 'qcur', 'qmax', 'scur', 'smax', 'slim', 'stot', 'bin', 'bout', 'dreq', 'dresp', 'ereq', 'econ', 'eresp', 'wretr', 'wredis', 'status', 'weight', 'act', 'bck', 'chkfail', 'chkdown', 'lastchg', 'downtime', 'qlimit', 'pid', 'iid', 'sid', 'throttle', 'lbtot', 'tracked', 'type', 'rate', 'rate_lim', 'rate_max', 'check_status', 'check_code', 'check_duration', 'hrsp_1xx', 'hrsp_2xx', 'hrsp_3xx', 'hrsp_4xx', 'hrsp_5xx', 'hrsp_other', 'hanafail', 'req_rate', 'req_rate_max', 'req_tot', 'cli_abrt', 'srv_abrt', '']
pxname
index: 0
svname
index: 1
qcur
@wjimenez5271
wjimenez5271 / .bash_profile
Created October 6, 2014 17:28
Random Password Generator for Bash (OSX)
# Borrowed from http://www.commandlinefu.com/commands/view/4183/generate-random-password
function randpass() {
cat /dev/urandom | env LC_CTYPE=C tr -dc a-zA-Z0-9 | head -c 16; echo
}
$ knife actor map; knife group show admin
Found 1 users and 1 clients
wrote map to 'actor-map.yaml'
ERROR: The object you are looking for could not be found
Response: Cannot load group admin
$ cat actor-map.yaml
---
:user_map:
:users: