Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -e -u -o pipefail
#Usage: source <(gopath)
is_go_dir() {
[[ -d src ]] && [[ -d pkg ]] && [[ -d bin ]]
}
find_go_path() {
#! /usr/bin/env bash
# usage: remme
# adapted from: http://usalug.org/phpBB2/viewtopic.php?t=13209&sid=a641eb81eff1925e714a2fc6576e8a13
set -eu
sleep_and_notify() {
local when=$1; shift
local title="$1"; shift
local body="$1"; shift
#!/bin/bash
set -e
# Your user name on OSIO
USER=${T-"SET YOUR USERNAME"}
# Get this from your Jenkins setting
API_TOKEN=${JENKINS_API_TOKEN:-"SET THIS"}
# You need to be login with oc or set this manually (but that may change on recration)
@sthaha
sthaha / reup
Created August 22, 2018 12:14 — forked from chmouel/reup
#!/bin/bash
PATH=$PATH:/usr/local/bin
set -ex
DOMAIN=openshift3.chmouel.com
VERSION=3.10.0
OC_VERSION=oc-v${VERSION}
INSTALLPATH=/etc/origin
import subprocess
from elasticsearch import Elasticsearch, Transport
def execute(command):
return subprocess.run(
['/bin/sh', '-c', f"{command}"],
stdout=subprocess.PIPE)
@sthaha
sthaha / release.yaml
Created February 28, 2019 12:22
knative-pipeline release.yaml
---
apiVersion: v1
kind: Namespace
metadata:
name: tekton-pipelines
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: tekton-pipelines-admin
@sthaha
sthaha / T.sh
Created February 28, 2019 14:14
Remind me after sometime or at a time
#! /usr/bin/env bash
# usage: remme
# adapted from: http://usalug.org/phpBB2/viewtopic.php?t=13209&sid=a641eb81eff1925e714a2fc6576e8a13
set -eu
sleep_and_notify() {
local when=$1; shift
local title="$1"; shift
local body="$1"; shift
@sthaha
sthaha / kubectl-ctx
Last active May 31, 2019 10:38
Adds a kubectl subcommand ctx to get and set namespace
#!/usr/bin/env bash
set -e -u -o pipefail
_log() {
local level=$1; shift
echo -e "$level: $@"
}
log.err() {
_log "ERROR" "$@" >&2
tasks:
- name: deploy
taskRef:
name: some-task
conditions:
# (x || y ) && (a || b)
- Kind: AnyCondition
spec:
conditions:
- ref: manual-approval
#!/usr/bin/env bash
colorfg() {
for i in {0..255}; do
printf "\x1b[38;5;${i}m ▩▩▩ %-5i\x1b[0m" $i
if ! (( ($i + 1 ) % 8 )); then
echo
fi