Skip to content

Instantly share code, notes, and snippets.


Ivan Pedrazas ipedrazas

View GitHub Profile
ipedrazas /
Created Aug 22, 2020
Processing SIGTERM in python
import signal
import time
class GracefulKiller:
kill_now = False
def __init__(self):
signal.signal(signal.SIGINT, self.exit_gracefully)
signal.signal(signal.SIGTERM, self.exit_gracefully)
def exit_gracefully(self,signum, frame):
ipedrazas / index.css
Created Jun 12, 2020
Gitops training - vue.js
View index.css
html, body {
margin: 0px;
background-color: #3a5e84;
color: white;
padding: 10;
margin-bottom: 20px;
ipedrazas /
Created Jun 12, 2020
Gitops Training - python
from flask import Flask, jsonify, request
from flask_cors import CORS
app = Flask(__name__)
@app.route('/ip', methods=["GET"])
def ip():
ipedrazas /
Created Jun 11, 2020
Training Requirements


You will need valid accounts for the following systems:


During the training we will use the following tooling:

ipedrazas /
Created May 18, 2020
Rename USB disk
# Source:
sudo apt-get install ntfsprogs
sudo fdisk -l
sudo umount /dev/sda1
sudo ntfslabel /dev/sda1 usb_ext_6t
mount /dev/sda1 /media/usb/usb_ext_6t
View gist:48e4f50913e40f064d7ddcca46505f66
-v=9 CURL command
-v=8 request and response body
-v=6 method and apipath
View gist:5b215409bbe592b33a21ae6a64f09b6c
gcloud beta container --project "deployments-team-01" clusters create "storage-test" \
--zone "us-central1-c" \
--no-enable-basic-auth \
--cluster-version "1.14.10-gke.17" \
--machine-type "n1-standard-2" \
--image-type "COS" \
--disk-type "pd-standard" \
--disk-size "100" \
--metadata disable-legacy-endpoints=true \
--scopes "","","","","","" \
View gist:5199d81f2a7bf0f8ed625369a8b3e777
from(bucket: "_monitoring") |>
range(start: -7d, stop: 1582912196) |>
filter(fn: (r) => r._measurement == "statuses" and r._field == "_message") |>
keep(columns: ["_time", "_value", "_check_id", "_check_name", "_level"]) |>
rename(columns: {"_time": "time", "_value": "message", "_check_id": "checkID", "_check_name": "checkName", "_level": "level"}) |>
group() |>
sort(columns: ["time"], desc: true) |>
limit(n: 100, offset: 0)
ipedrazas /
Created Feb 7, 2020
List pods with secrets in volumes or envvars
kubectl get pods -n main -o=jsonpath="{range .items[*]}{}{'\t'}{.status.startTime}{'\n'}{'\t'}Volumes:{'\t'}{.spec.volumes[*].secret.secretName}{'\n'}{'\t'}Envvars:{'\t'}{.spec.containers[*].env[*].valueFrom.secretKeyRef}{.name}{.key}{'\n'}{end}"


gw-main-7b5789879-w85tz	2020-02-06T20:07:00Z
	Volumes:	gw-token-jrwgm istio.gateway
	Envvars:	map[key:client-id name:salesforce] map[key:redirect-url name:salesforce] map[key:public-url name:salesforce]
View gist:c1ff50b9e47ff8210d736f61cd3f6db9
helm ls --all --short | xargs -L1 helm delete --purge
You can’t perform that action at this time.