Skip to content

Instantly share code, notes, and snippets.

View zeisss's full-sized avatar
🍪
Eat More Chocolate Cookies!

Stephan zeisss

🍪
Eat More Chocolate Cookies!
View GitHub Profile
$ ./etcd -v -f -data-dir /var/lib/etcd -bind-addr 0.0.0.0 -addr 192.168.53.2:4001 -peer-addr 192.168.53.2:7001 -peer-bind-addr 0.0.0.0 -discovery https://discovery.etcd.io/86bf5ce860eef35b94f9f616fb55964f -name dockzero-01
[etcd] Mar 10 10:19:40.979 DEBUG | open /var/lib/etcd/snapshot: permission denied
[etcd] Mar 10 10:19:40.982 INFO | Discovery via https://discovery.etcd.io using prefix /86bf5ce860eef35b94f9f616fb55964f.
[etcd] Mar 10 10:19:42.081 INFO | Discovery _state was empty, so this machine is the initial leader.
[etcd] Mar 10 10:19:42.081 INFO | Discovery fetched back peer list: []
[etcd] Mar 10 10:19:42.081 DEBUG | This peer is starting a brand new cluster based on discover URL.
@zeisss
zeisss / main.go
Last active August 29, 2015 13:57
Alternative design to specify name/group/... for goHystrix
package main
import (
"fmt"
goHystrix "github.com/ZeissS/goHystrix"
)
type DeleteTransactionCommand struct {
TransactionId string
}
@zeisss
zeisss / service1a.service
Last active August 29, 2015 14:04
Scheduling bug in fleet/systemd for a failover
[Unit]
Description=S1
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c 'sleep 30; echo OK'
[X-Fleet]
X-ConditionMachineOf=service2.service
@zeisss
zeisss / randhex.go
Created September 13, 2014 23:19
Random hex formatted string generator.
package main
import (
"crypto/rand"
"encoding/hex"
"fmt"
"flag"
)
@zeisss
zeisss / parse.js
Last active August 29, 2015 14:07
Transform the state in a etcd snapshot into a etcd-dump compatible json file
var fs = require('fs');
function visit(node, state) {
// console.log('visit', node.Path);
if (node.Value == "") {
return;
}
state.push({
key: node.Path,
// parallel performs the given actions with `n` actions in parallel.
// Make `n == len(actions)` to perform all actions in parallel.
//
// Arguments
// actions - The functions you want to execute. Error results will be reported to the errors channel.
// n - the number of parallel actions to execute in maximum. Must be positive.
// errors - Optional channel to report errors back to. Will be closed.
// cancel - Optional channel to signal abortion of processing.
func parallel(actions []func() error, n int, errors chan<- error, cancel <-chan struct{}) {
if len(actions) == 0 {
package main
import "time"
import "fmt"
import "math/rand"
// parallel performs the given actions with `n` actions in parallel.
// Make `n == len(actions)` to perform all actions in parallel.
//
// Arguments
@zeisss
zeisss / gist:98f5bb5d6c01fe62225e
Created June 11, 2015 20:59
Second Golang Meetup - Go Channels 101
# Go Channels
Dennis - dennis@giantswarm.io or @denderello
Stephan - stephan@giantswarm.io or @zeisss_public
> "Don't communicate by sharing memory, share memory by communicating." -- Rob Pike
## Problem
etcdctl ls /path/api/ --recursive|xargs -I{} echo 'A="$(etcdctl get {})" && etcdctl set $(echo {}|sed s/api/othername/) "${A}"; unset A'
@zeisss
zeisss / gist:151d3323955ec6e9b44f
Created June 26, 2015 09:39
Finding the channels of a user in slack
curl https://api.slack.com/api/channels.list -d "token=${TOKEN}" | jq '.channels[] | {name: .name, m: (.members[] | contains("$MEMBERID"))}'|grep -B1 true|grep name