Skip to content

Instantly share code, notes, and snippets.

View danielhopkins's full-sized avatar

Dan Hopkins danielhopkins

View GitHub Profile

Keybase proof

I hereby claim:

  • I am danielhopkins on github.
  • I am danielhopkins (https://keybase.io/danielhopkins) on keybase.
  • I have a public key whose fingerprint is 2E91 3537 6B3F 35C1 EEEF 8DF6 EC7E 8CD5 7534 6D81

To claim this, I am signing this object:

@danielhopkins
danielhopkins / gist:f5a67989e5ad9291a872
Created September 19, 2014 13:56
webhook_output.txt
vo_alert_type: "SERVICE"
entity_state: "CRITICAL"
entity_id: "HTTP"
vo_organization_id: "bogus123"
timet: "1410726048"
state_start_time: "1410726048"
servicegroupname: "revenue-svcs"
host_name: "vaal"
hostgroupname: "tos-servers"
vo_uuid: "c747abb5-fb47-416b-baf3-468b111ea324"
@danielhopkins
danielhopkins / sample_server.rb
Last active August 29, 2015 14:06
enhanced webhooks post
require 'rubygems'
require 'sinatra'
# Enter your API key from the REST integration tab
$API_KEY = "API_KEY"
# Download the basic vo.rb from https://gist.github.com/danielhopkins/7569899
$VO_RB = '~/bin/vo.rb'
post '/webhook' do
state = params['entity_state'].gsub('"', '')
#!/bin/bash
for i in `seq 1 10`; do
echo "----------$i"
echo "Network"
~/src/cassie-class/cassandra/bin/nodetool -h 127.0.0.1 -p 7100 getendpoints network_keyspace test $i 2>/dev/null
echo "Simple"
~/src/cassie-class/cassandra/bin/nodetool -h 127.0.0.1 -p 7100 getendpoints simple_keyspace test $i 2>/dev/null
done
@danielhopkins
danielhopkins / foo.rb
Created May 16, 2014 16:00
for nate.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'uri'
require 'net/http'
json = [
{:foo => "bar"},
{:foo => 'chicken'},
@danielhopkins
danielhopkins / vo.rb
Last active December 14, 2016 13:55
Really simple example of using the victorops api to create incidents
#!/usr/bin/env ruby
require 'uri'
require 'net/http'
require "net/https"
require 'optparse'
url_path = "integrations/generic/20131114/alert"
options = {}

This link

class EchoActor extends Actor with ActorLogging {
val cluster = Cluster(context.system)
override def preStart() { cluster.subscribe(self, classOf[LeaderChanged]) }
override def postStop() { cluster.unsubscribe(self) }
def receive = {
case state: CurrentClusterState => log.info(s"State is $state")
case LeaderChanged(leader) => log.info(s"Leader is $leader")
case msg => {
@danielhopkins
danielhopkins / timeout.scala
Created March 17, 2013 20:58
Timeouts for actors
/*
The general idea is to handle timeouts as a message instead of using callbacks or worse yet, blocking
the actor (as I do below)
*/
val system = ActorSystem()
val myactor = system.actorOf(Props[MyActor])
val someotheractor = system.actorOf(Props[SomeotherActor])
class MyActor extends Actor with ActorLogging {
@danielhopkins
danielhopkins / gist:5162770
Created March 14, 2013 16:22
git push mirror
# from .git_functions
function git_helpers_clean_remote() {
remote=$1
git ls-remote -h $remote |
git show-ref --heads --exclude-existing |
cut -f 2 | xargs git push --delete $remote
}
# from .gitconfig
[alias]