Skip to content

Instantly share code, notes, and snippets.

@cuotos
cuotos / rotatingcursor.sh
Created November 16, 2017 12:32
Rotating Cursor
#!/bin/bash
# Written by Locutus for bash demonstration.
rotateCursor()
{
case $toggle
in
1)
echo -n $1" \ "
echo -ne "\r"

Keybase proof

I hereby claim:

  • I am cuotos on github.
  • I am cuotos (https://keybase.io/cuotos) on keybase.
  • I have a public key ASDzYhgFpqsvO0C2QCOGLqQBUjAVilojeJp14jXcoNGwTgo

To claim this, I am signing this object:

@cuotos
cuotos / containsEnvVars
Last active April 20, 2020 21:53
jsonnetunit needle haystack lookup.
{
// containsEnvVars checks that all needles (k8s env variable "name" and "value" objs) exist in the haystack (pod env block) object
// i.e. asserts structs exist in array
containsEnvVars(haystack, needles):: (
// create an array, 1 element per needle
local results = [
// check the needle is valid (it contains the two required fields)
if (std.objectHas(needle, 'name') && std.objectHas(needle, 'value')) then
// needle is valid
@cuotos
cuotos / nonexistingbranches.py
Last active February 24, 2020 12:52
find local git branches that do not exist on remote
#!/usr/bin/env python
import subprocess
try:
branches = subprocess.check_output(['git', 'branch', '-a']).splitlines()
except subprocess.CalledProcessError as e:
quit(e.returncode)
@cuotos
cuotos / pusher proxy
Last active March 11, 2020 10:36
OAuth Stuff
docker run \
--rm \
-ti \
-p 4180:4180 \
-e OAUTH2_PROXY_REDIRECT_URL=http://localhost:4180/oauth2/callback \
-e OAUTH2_PROXY_PROVIDER=github \
-e OAUTH2_PROXY_UPSTREAMS="static://200" \
-e OAUTH2_PROXY_HTTP_ADDRESS="0.0.0.0:4180" \
-e OAUTH2_PROXY_EMAIL_DOMAINS="*" \
-e OAUTH2_PROXY_COOKIE_SECURE=false \
@cuotos
cuotos / datasources.yml
Last active April 17, 2020 15:43
local-prom
apiVersion: 1
datasources:
- name: Prom
type: prometheus
url: http://localhost:9090
access: direct
@cuotos
cuotos / fix-k8s-go-mod-dependencies.sh
Last active June 11, 2020 17:59
script to get the correct k8s go versions
#!/bin/sh
# https://github.com/kubernetes/kubernetes/issues/79384#issuecomment-521493597
set -euo pipefail
VERSION=${1#"v"}
if [ -z "$VERSION" ]; then
echo "Must specify version!"
exit 1
@cuotos
cuotos / bash_logout
Created October 9, 2020 10:09
funny unix logout message
# ~/.bash_logout
echo -n "Please rate your experience at $(hostname --fqdn) on a scale of 1 to 10: "
read rating
echo "+ echo $rating >> /dev/null"
echo "Thank you, $USER! Your feeback is important to us!"
@cuotos
cuotos / sleep_sort.sh
Created October 9, 2020 10:10
funny sorting alg
#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]; do
f "$1" &
shift
done
wait
@cuotos
cuotos / deploy.yaml
Created November 17, 2020 19:47
basic kube manifests
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
role: training
spec:
replicas: 3
selector:
matchLabels: