Skip to content

Instantly share code, notes, and snippets.

@therealbill
therealbill / SentinelReplicator.py
Created July 25, 2014 17:46
A simple means for replication a sentinel's in-memory config to a new sentinel.
#!/usr/bin/env python
import redis
import sys
origin_ip,origin_port = sys.argv[1].split(":")
target_ip,target_port = sys.argv[2].split(":")
origin = redis.Redis(origin_ip,origin_port)
target = redis.Redis(target_ip,target_port)
@therealbill
therealbill / sts.go
Last active August 29, 2015 14:13 — forked from oxtoacart/sts.go
package main
import (
"fmt"
"math/rand"
"sort"
"time"
)
const (
@therealbill
therealbill / redskull-to-sentinel.py
Created May 23, 2015 20:41
Recover Sentinel Config From Red Skull
#!/usr/bin/env python
import requests
for pod in requests.get("http://localhost:8000/api/knownpods").json()['Data']:
print "sentinel monitor {Name} {Info[IP]}:{Info[Port]} 2\nsentinel set {Name} auth-pass {AuthToken}".format(**pod)
#!/usr/bin/env python
import timeit
from random import choice
def getTriplets(top=1000):
triplets = []
for c in xrange(top,3,-1):
maxb = top-c - 1
for b in xrange(maxb,0,-1):
@therealbill
therealbill / samplelayout.txt
Created August 24, 2012 21:06
How I'd like to have my Flask project
/siteroot/
runserver.py
site.wsgi
/templates/ (for root/global templates)
layout.html
/static/
/css/
/js/
/section1/
__init__.py
@therealbill
therealbill / proxy_copy.go
Created November 17, 2015 20:44 — forked from jbardin/proxy_copy.go
Go TCP Proxy pattern
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
clock:
/etc/sysconfig/clock:
file.managed:
- source: salt://core/files/clock
/etc/localtime:
file.symlink:
- target: /usr/share/zoninfo/America/Los_Angeles
- force: true
@therealbill
therealbill / salt traceback on TAGPARTER build
Last active December 24, 2015 12:29
Gettign this error on salt 0.17.0-438-gbbd35e7 during a highstate run. worked fine on 0.17.0-34-gb19c17c
[INFO ] Executing state pkg.installed for python-pip
[INFO ] Package python-pip is already installed
[ERROR ] An un-handled exception was caught by salt's global exception handler:
TypeError: sequence item 1: expected string, int found
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 77, in salt_call
client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/__init__.py", line 303, in run
binary:
go build
deps-save:
godep save
deps:
godep restore
Do you want to read a git diff?
Or write an ansible play?
I never see you anymore
Come out the door
It's like you've gone away...
We used to be system admins
And now we're not
I wish you would tell me why!
Do you want to build a container?
It doesn't have to be with docker