Skip to content

Instantly share code, notes, and snippets.

@talonx
talonx / reading-property-from-file.sh
Created September 19, 2017 09:46 — forked from marcelbirkner/reading-property-from-file.sh
Read property from properties file within Shell Script
#!/bin/sh
PROPERTY_FILE=apps.properties
function getProperty {
PROP_KEY=$1
PROP_VALUE=`cat $PROPERTY_FILE | grep "$PROP_KEY" | cut -d'=' -f2`
echo $PROP_VALUE
}
@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
kind: Service
....
metadata:
name: backend-1
annotations:
service.beta.kubernetes.io/external-traffic: OnlyLocal
...
@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?
apiVersion: v1
kind: Service
metadata:
name: backend-1
spec:
....
externalTrafficPolicy: Local
type: LoadBalancer
node_name=`kubectl get pod ${pod_name} -o json | jq '. | .spec.nodeName'`
public_ip=`gcloud compute instances list --filter="name=(${node_name})" --format="value(networkInterfaces[].accessConfigs[0].natIP)"`
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${keyfile} k8s-debug-vm.sh k8s-debug-toolbox.sh ${user}@${public_ip}:
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${keyfile} ${user}@${public_ip} sh k8s-debug-vm.sh ${pod_name} ${action} ${bucket}
@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"