Skip to content

Instantly share code, notes, and snippets.

View dijeesh's full-sized avatar
😎

Dijeesh Padinharethil dijeesh

😎
View GitHub Profile
@dijeesh
dijeesh / XenServer Pool patching script
Last active August 15, 2016 13:30
Bash Script to install XenServer patches
#! /bin/bash
# XenServer Pool Patching Script
set -euo pipefail
readonly PATCHFILE=$1
pushd /root/hotfix >/dev/null || exit 1
readonly HOSTS=$(xe host-list --minimal |tr , ' ')
UUID=$(xe patch-upload file-name="$PATCHFILE")
@dijeesh
dijeesh / IPSec VPN between Amazon VPC and Juniper SRX
Last active September 29, 2022 10:22
SRX Rules for creating IPSec Tunnel between Amazon VPC and Juniper SRX
Tunnel 1
===================================
set security ike proposal ike-prop-vpn-to-aws-1 authentication-method pre-shared-keys
set security ike proposal ike-prop-vpn-to-aws-1 authentication-algorithm sha1
set security ike proposal ike-prop-vpn-to-aws-1 encryption-algorithm aes-128-cbc
set security ike proposal ike-prop-vpn-to-aws-1 lifetime-seconds 28800
set security ike proposal ike-prop-vpn-to-aws-1 dh-group group2
set security ike policy ike-pol-vpn-to-aws-1 mode main
@dijeesh
dijeesh / get list of mysql users and grants
Last active March 9, 2017 13:19
get list of mysql users and grants
root@db-001:~# mygrants $@ mygrants()
{
mysql -BN $@ -e "SELECT DISTINCT CONCAT('SHOW GRANTS FOR ''',user,'''@''',host,''';') AS query FROM mysql.user" | \
mysql $@ | \
sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}'
}
This will generate GRANTS for each user in your MySQL database server.
#! /bin/bash
# Dijeesh Padinhaethil
# Script to take MySQL backups to remote server using Percona Xtrabackup
# Confirm log directory exist, create on if doesn't.
#!/bin/bash
# XenServer Disk Monitoring and post message to XenCenter
# Get this host's UUID
thisUUID=`xe host-list name-label=$HOSTNAME params=uuid --minimal`
# Threshold of disk usage to report on
threshold=75 # an example of how much disk can be used before alerting
# Get disk usage
cd /var/named
sed -i 's/20[0-9][0-9]\{7\}/2016120701/g’ *.db
This will set Serial Numbers for all zones to : 2016120701 [ YYYYMMDDNN ]
Take a backup of named directory before updating serial numbers.
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'CloudFormation - EKS VPC Stack'
Parameters:
EnvironmentName:
Description: 'CloudFormation - EKS VPC Stack'
Type: String
Default: '- CloudFormation - EKS VPC Stack'
VPCName:
1. Install jq
2. Run
(
NAMESPACE=YOUR-NAMESPACE
kubectl proxy &
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize
)
SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema;
@dijeesh
dijeesh / gist:5c0b915fb6b428a92d9fc9175d55dae3
Created February 4, 2019 09:56
docker-compose-metabase-postgress
version: '3'
services:
db:
container_name: db
image: postgres:9.6
restart: always
volumes:
- "/data/metabase/pgdata:/var/lib/postgresql/data"