Skip to content

Instantly share code, notes, and snippets.

View raj-saxena's full-sized avatar
🎯
Focusing

Raj Saxena raj-saxena

🎯
Focusing
View GitHub Profile
@raj-saxena
raj-saxena / run-arbitrary-commands.sh
Last active May 18, 2022 14:57
To test the logging & reporting of running a script
#!/bin/bash
set -o errexit -o nounset -o pipefail -o xtrace
echo "Hello World"
curl -I "https://app.n26.com/login"
# install software
sudo apt update
sudo apt install -y iputils-ping netcat
# Ouput of `k get kafka -o yaml -n strimzi`
apiVersion: v1
items:
- apiVersion: kafka.strimzi.io/v1beta1
kind: Kafka
metadata:
annotations:
meta.helm.sh/release-name: kafka
meta.helm.sh/release-namespace: strimzi
creationTimestamp: "2020-12-28T08:06:05Z"
apiVersion: kafka.strimzi.io/v1beta1
kind: Kafka
metadata:
name: my-cluster
spec:
# kafka cluster configuration
kafka:
# Annotations for Datadog JMX auto-discovery
template:
pod:
@raj-saxena
raj-saxena / ubuntu-fresh-install
Last active October 14, 2020 13:00
Setup Ubuntu VM
# Resolution mapping with Mac - 1920x1200
# Virtual box display scaling - 165%
# Oh-my-zsh
sudo apt install git zsh
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sh install.sh
# Docker
sudo apt-get update
@raj-saxena
raj-saxena / gcp_compute_mount_persistent_disk.sh
Last active August 30, 2023 23:57
Use the following script to mount a persistent storage during startup. This is helpful when you provision the compute instance as well as the persistent disk using some automation tool like Terraform. StackOverFlow question - https://stackoverflow.com/questions/53162620/automate-gcp-persistent-disk-initialization
#!/bin/bash
set -uxo pipefail
# DISK_NAME = Name of the disk in terraform
# DEVICE_NAME = When $DISK_NAME is mounted in the compute instance at `/dev/`
MOUNT_DIR=/mnt/disks/persistent_storage
# Check if entry exists in fstab
grep -q "$MOUNT_DIR" /etc/fstab
@raj-saxena
raj-saxena / gcp_compute_mount_persistent_disk.sh
Created January 8, 2020 13:12
Use the following script to mount a persistent storage during startup. This is helpful when you provision the compute instance as well as the persistent disk using some automation tool like Terraform.
#!/bin/bash
set -euxo pipefail
if [[ -d "/mnt/disks/persistent_storage" ]]; then
exit
else
sudo mkfs.ext4 -m 0 -F -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb; \
sudo mkdir -p /mnt/disks/persistent_storage
sudo mount -o discard,defaults /dev/sdb /mnt/disks/persistent_storage
fi
@raj-saxena
raj-saxena / Macbook - change key mapping .md
Last active June 13, 2021 16:07
Change the weird key(§/±) on International keyboard to grave accent and tilde(`/~) and vice versa.

Change the weird key(§/±) on International keyboard to grave accent and tilde(`/~) and vice versa.

hidutil property --set '{
  "UserKeyMapping": [
    {
      "HIDKeyboardModifierMappingSrc": 0x700000064,
      "HIDKeyboardModifierMappingDst": 0x700000035
    },
    {
  • install iterm, oh-my-zsh

  • clone zsh auto-suggestions and enable in .zshrc

  git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  • Add ssh keys
 eval "$(ssh-agent -s)"
#!/bin/bash
sudo docker stop $(docker ps -aq)
sudo docker rm $(docker ps -a -q)
docker network prune -f
docker volume rm $(docker volume ls -f dangling=true -q)
#docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro -v /var/lib/docker:/var/lib/docker martin/docker-cleanup-volumes
{
"contentType": "application/gliffy+json",
"version": "1.3",
"metadata": {
"title": "untitled",
"revision": 0,
"exportBorder": false,
"loadPosition": "default",
"libraries": [
"com.gliffy.libraries.flowchart.flowchart_v1.default",