Skip to content

Instantly share code, notes, and snippets.

@talonx
talonx / monzo-alertmanager-config.yaml
Created November 30, 2021 05:06 — forked from milesbxf/monzo-alertmanager-config.yaml
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@talonx
talonx / Jenkinsfile.groovy
Created February 20, 2020 11:17 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${keyfile} ${user}@${public_ip} sh k8s-debug-vm.sh ${pod_name} ${action} ${bucket}
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${keyfile} k8s-debug-vm.sh k8s-debug-toolbox.sh ${user}@${public_ip}:
public_ip=`gcloud compute instances list --filter="name=(${node_name})" --format="value(networkInterfaces[].accessConfigs[0].natIP)"`
node_name=`kubectl get pod ${pod_name} -o json | jq '. | .spec.nodeName'`
apiVersion: v1
kind: Service
metadata:
name: backend-1
spec:
....
externalTrafficPolicy: Local
type: LoadBalancer
@talonx
talonx / service.yaml
Created December 2, 2019 05:35 — forked from matthewpalmer/service.yaml
overview of kubernetes port definitions
kind: Service
apiVersion: v1
metadata:
name: port-example-svc
spec:
# Make the service externally visible via the node
type: NodePort
ports:
# Which port on the node is the service available through?
kind: Service
....
metadata:
name: backend-1
annotations:
service.beta.kubernetes.io/external-traffic: OnlyLocal
...
@talonx
talonx / convert.py
Created August 14, 2018 11:30 — forked from rednebmas/convert.py
Convert sqlite3 dump to mysql importable statements
import re, fileinput
print 'SET FOREIGN_KEY_CHECKS=0;'
def main():
for line in fileinput.input():
process = False
for nope in ('BEGIN TRANSACTION','COMMIT',
'sqlite_sequence','CREATE UNIQUE INDEX'):
if nope in line: break