Skip to content

Instantly share code, notes, and snippets.

View evrardjp's full-sized avatar

Jean-Philippe Evrard evrardjp

View GitHub Profile
@evrardjp
evrardjp / gather_files.sh
Last active April 21, 2024 08:07
Backup Arch linux files
#!/usr/bin/env bash
MACHINE=$(cat /etc/hostname)
#DATE=$(date -Iminutes) #FOR MORE DETAILS
DATE=$(date -I) #JUST THE DATE
BACKUP_PATH=/root/backup-$MACHINE-$DATE
mkdir -p ${BACKUP_PATH}
function copy_file {
echo "Copying $1"
@evrardjp
evrardjp / MySQL network benchmark
Created July 8, 2021 07:04 — forked from stickystyle/MySQL network benchmark
Simple script to monitor the network latencey between app servers and DB servers
#!/bin/env python
import timeit
loops = 1000
setup = """
import MySQLdb
db = MySQLdb.connect(host="remotedb.example.com",
read_default_file="/root/.my.cnf",
@evrardjp
evrardjp / command.sh
Last active April 15, 2021 12:20
Try rebooting without privileges
#!/usr/bin/env bash
kubectl exec -it long-running-pids -- kill -SIGRTMIN+15 1
# Get etcd keys with kubernetes api credentials
export ENDPOINT="172.18.0.2:2379"
ETCDCTL_API=3 etcdctl --endpoints=$ENDPOINT --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/apiserver-etcd-client.crt --key /etc/kubernetes/pki/apiserver-etcd-client.key get / --prefix --keys-only
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
/*
* Copyright (c) 2019 SUSE LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#!/usr/bin/env python3
# put yourself in the folder of the _service file, and run this.
# use the output for writing your osc vc or change file
import os
import re
import requests
from urllib.parse import urlparse
@evrardjp
evrardjp / README.md
Created November 15, 2019 11:21 — forked from adambom/README.md
Backup Kubernetes Cluster State

Run this in order to backup all you k8s cluster data. It will be saved in a folder bkp. To restore the cluster, you can run kubectl apply -f bkp.

Please note: this recovers all resources correctly, including dynamically generated PV's. However, it will not recover ELB endpoints. You will need to update any DNS entries manually, and manually remove the old ELB's.

Please note: This has not been tested with all resource types. Supported resource types include:

  • services
  • replicationcontrollers
  • secrets
  • deployments
  • horizontal pod autoscalers
@evrardjp
evrardjp / cilium-debug.sh
Last active October 3, 2019 09:36
cilium-debug.sh
#!/bin/bash
if [ $# -ne 2 ]
then
echo "Usage: cilium-debug.sh <pod> <namespace>"
exit 1
fi
pod_node=$(kubectl get pods $1 -owide -n $2 | awk '{print $7}' | tail -n1)
echo "Pod location: ${pod_node}"
@evrardjp
evrardjp / autorelease.sh
Created September 23, 2019 14:47
OpenStack -- Releases -- RC1 autorelease
#!/bin/bash
pushd releases
git checkout master
git pull
releasename="train"
function propose_release(){
rtype=$1