Skip to content

Instantly share code, notes, and snippets.

View lomkju's full-sized avatar

Arjun Hemrajani lomkju

View GitHub Profile
@lomkju
lomkju / test.yaml
Created June 23, 2022 04:58
k8s-shell-pod
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- args:
- -c
- while true; do sleep 10;done
command:
@lomkju
lomkju / redash.yml
Created May 12, 2020 10:42
Redash Test Server
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: redash
name: redash
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
@lomkju
lomkju / kafka_worker.yml
Last active May 11, 2020 15:28
HPA Examples
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: kafka-consumer
annotations:
# metric-config.<metricType>.<metricName>.<collectorName>/<configKey>
metric-config.external.http.json/json-key: "$stats"
metric-config.external.http.json/endpoint: "http://www.mocky.io/v2/5eb958772f0000b32c3c3098"
spec:
scaleTargetRef:
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/
@lomkju
lomkju / gist:6a65905bd7e3750f393b19d58626cd5c
Last active April 3, 2020 10:54
CPU Performance Parameters For Ubuntu
/*
This is how to speed up you linux machine.
https://askubuntu.com/questions/604720/setting-to-high-performance
*/
#Available modes
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
#Check processor mode
@lomkju
lomkju / databseCommands.txt
Last active February 14, 2020 10:08
Database Commands
#MSQL
CREATE DATABASE `DB_NAME`;
CREATE USER `DB_USER`@'%' IDENTIFIED BY 'DB_PASS';
GRANT CREATE,DELETE,INSERT,SELECT,UPDATE ON `DB_NAME`.* TO `DB_USER`@'%';
SELECT User from mysql.user;
SELECT User from mysql.user WHERE USER='DB_USER';
SHOW GRANTS for DB_USER;
FLUSH PRIVILEGES;
REVOKE INSERT ON *.* FROM 'jeffrey'@'localhost';
@lomkju
lomkju / dump.sh
Created July 30, 2018 07:11
K8s namespace dump
if [ -z "$1" ]
then
echo "Please pass the namespace as the argument!"
else
timestamp=`date "+%Y-%m-%d"`
dir="$1_dump_$timestamp"
mkdir -p $dir
for n in $(kubectl get -n $1 -o=name cm,ing,svc,secret,deployment,ds | grep -v 'secrets/default-token')
do
kubectl get -n $1 -o=yaml --export $n > $dir/$(dirname $n)_$(basename $n).yaml
@lomkju
lomkju / docker.sh
Created May 17, 2018 14:21
Install Docker
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@lomkju
lomkju / RandomString.sh
Last active February 14, 2020 09:14
Random String
#Simple commands to generate random strings.
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
openssl rand -base64 15
openssl rand -hex 15
@lomkju
lomkju / portainer.sh
Last active March 9, 2018 11:43
Portainer
#Create a volume for portainer
docker volume create portainer
#Run portainer forever
docker run -d --name portainer -p 9000:9000 --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer:/data portainer/portainer