Skip to content

Instantly share code, notes, and snippets.

View garlandkr's full-sized avatar
🎯
Focusing

Ken Garland garlandkr

🎯
Focusing
View GitHub Profile
@garlandkr
garlandkr / hipchat-test.rb
Created March 31, 2015 15:52
Ruby HipChat Example
require 'hipchat'
hipchat_room = 123456
hipchat_name = 'Bot Name'
msg = 'This is a test'
api_token = '1234567890-=!@#$%^&*()_+'
client = HipChat::Client.new(api_token, :api_version => 'v2')
client[hipchat_room].send(hipchat_name, msg, :color => 'purple')
#/usr/bin/env ruby
# Sends events to hipchat for wonderful chatty notifications
#
# This extension requires the hipchat gem
#
# The reason I wrote this instead of using the normal hipchat handler, is that with Flapjack
# all events are handled unless you do crazy filtering stuff. Also with a large number of events
# and checks the sensu server can get overloaded with forking stuff. So anyway, hipchat extension :)
#
#/usr/bin/env ruby
# Sends events to hipchat for wonderful chatty notifications
#
# This extension requires the hipchat gem
#
# The reason I wrote this instead of using the normal hipchat handler, is that with Flapjack
# all events are handled unless you do crazy filtering stuff. Also with a large number of events
# and checks the sensu server can get overloaded with forking stuff. So anyway, hipchat extension :)
#
@garlandkr
garlandkr / README.md
Last active August 29, 2015 14:18 — forked from masha256/README.md

Description

A Dashing widget to show Hipchat user presence on a dashboard.

Dependencies

Add the following to your dashing Gemfile

gem 'hipchat'
@garlandkr
garlandkr / README.md
Last active August 29, 2015 14:18 — forked from alekstorm/README.md

Installation

To install, place datadog.py in your callback plugins directory. If you don't yet have one, run:

mkdir -p plugins/callback

Then place the following in your ansible.cfg file:

[defaults]

callback_plugins = ./plugins/callback

@garlandkr
garlandkr / gist:5b007cf5b090b5d381c9
Created March 23, 2015 15:42
Assigning shards in ElasticSearch
# First get the unassigned shard indices
curl -XGET http://localhost:8080/_cat/shards --silent | grep UNASS | awk '{print$1,$2}' | awk '!a[$0]++' > indices.txt
# Now assign them to the proper node.
cat indices.txt | while read -r index shard; do
curl -XPOST 'localhost:8080/_cluster/reroute' -d "{
\"commands\" : [ {
\"allocate\" : {
\"index\" : \"$index\",
\"shard\" : \"$shard\",
{
"client":{
"name":"host01",
"address":"10.2.1.11",
"subscriptions":[
"all",
"env_qa",
"frontend",
"proxy",
"apache"
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@garlandkr
garlandkr / README.md
Last active August 29, 2015 14:14 — forked from alekstorm/README.md

Installation

To install, place datadog.py in your callback plugins directory. If you don't yet have one, run:

mkdir -p plugins/callback

Then place the following in your ansible.cfg file:

[defaults]

callback_plugins = ./plugins/callback

#!/bin/bash
# This file was placed here by Gitlab. It makes sure that your pushed commits
# will be processed properly.
while read oldrev newrev ref
do
# For every branch or tag that was pushed, create a Resque job in redis.
pwd=`pwd`
reponame=`basename "$pwd" | cut -d. -f1`