Skip to content

Instantly share code, notes, and snippets.

View karampok's full-sized avatar

Konstantinos Karampogias karampok

View GitHub Profile
@karampok
karampok / install-run-consul.sh
Last active November 24, 2017 15:20
install-run-consul.sh
#! /bin/bash
echo "Installing dependencies ..."
sudo apt-get update
sudo apt-get install -y unzip curl jq
echo "Determining Consul version to install ..."
CHECKPOINT_URL="https://checkpoint-api.hashicorp.com/v1/check"
if [ -z "$CONSUL_DEMO_VERSION" ]; then
CONSUL_DEMO_VERSION=$(curl -s "${CHECKPOINT_URL}"/consul | jq .current_version | tr -d '"')
fi
@karampok
karampok / tmate.conf
Last active December 12, 2017 09:10
kubo-team tmate.conf (`tmate -f ~/.tmate.conf`)
set-option -g prefix C-space
bind-key C-space last-window
set -g base-index 1
set -s escape-time 0
set-option -g history-limit 200000
set-option -g status-keys vi
setw -g mode-keys vi
unbind p
bind p paste-buffer
#!/bin/sh
# http://iamvery.com/2013/11/16/tmux-pairing-anywhere-on-your-box.html
command="$(basename "$0")"
# Make sure dependencies are installed
[ ! "$(command -v gh-auth)" ] && echo "gh-auth not found (gem install github-auth)" && exit 1
[ ! "$(command -v tmux)" ] && echo "tmux not found" && exit 1
help(){
@karampok
karampok / weave.yml
Created March 7, 2018 18:39
Weave with FASTDP disabled
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ServiceAccount
metadata:
name: weave-net
annotations:
cloud.weave.works/launcher-info: |-
{
@karampok
karampok / cc.md
Last active August 16, 2018 14:30

Deploying CFCR with cloud provider:

  1. Given a bosh director
  2. Create service-accounts for master and worker link and save the name into a var file.
cat <deploymentName.cc>.vars 
    cfcr_master_service_account_address: bbl-158293-cfcr-master@cf-pcf-kubo.iam.gserviceaccount.com
    cfcr_worker_service_account_address: bbl-158293-cfcr-worker@cf-pcf-kubo.iam.gserviceaccount.com
@karampok
karampok / grootfs-issue.md
Created November 29, 2018 12:51
Grootfs issue

how to create a container directly in garden

bosh ssh -d cloudfoundry cell/X
sudo -i && cd /root
wget https://github.com/contraband/gaol/releases/download/2016-8-22/gaol_linuxchmod +x gaol_linux
./gaol_linux -t /var/vcap/data/garden/garden.sock  create -n testme
./gaol_linux -t /var/vcap/data/garden/garden.sock list
./gaol_linux -t /var/vcap/data/garden/garden.sock  shell testme
./gaol_linux -t /var/vcap/data/garden/garden.sock  destroy testme
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
type myFrame struct {
epoch uint16
seq uint32
}
func (f myFrame) Matches(x interface{}) bool {
//b := []byte(fmt.Sprintf("%v", x.(interface{})))
//epoch := common.Order.UintN(x[1:3], 2)
//seq := common.Order.UintN(b[3:6], 3)
// more logic here
// UnionFetcher fetches from east and west and combines the result. If one
// fetcher fails only the reply of the other fetcher is returned.
type UnionFetcher struct {
East, West PathFetcher
}
// GetPaths gets paths from both fetchers.
func (f *UnionFetcher) GetPaths(ctx context.Context, req *sciond.PathReq,
earlyReplyInterval time.Duration, logger log.Logger) (*sciond.PathReply, error) {
@karampok
karampok / tail.go
Created January 21, 2020 13:14
Tailer
func (w *Watcher) Initialize() error {
lines := make(chan (string))
//go get lines from file
go func(file string) {
defer close(lines)
//NOTE. To implement tail properly is challenging
// here is a link with nice explanation
// https://github.com/fstab/grok_exporter/wiki/tailer-(tail-%E2%80%90f)
// In all cases, if custom-made tail implementation is needed