Skip to content

Instantly share code, notes, and snippets.

View vadirajks's full-sized avatar

Vadiraj K.S vadirajks

View GitHub Profile
@vadirajks
vadirajks / redshift_performance_tuning.sql
Created August 3, 2016 08:52 — forked from bobbydennett/redshift_performance_tuning.sql
Redshift performance tuning-related queries
--------------------
-- Incorrect column encoding
--------------------
SELECT database, schema || '.' || "table" AS "table", encoded, size
FROM svv_table_info
WHERE encoded='N'
ORDER BY 2;
SELECT trim(n.nspname || '.' || c.relname) AS "table",trim(a.attname) AS "column",format_type(a.atttypid, a.atttypmod) AS "type",
@vadirajks
vadirajks / ec2-ssh
Created August 9, 2016 10:07 — forked from mo-ya/ec2-ssh
#!/bin/sh
## EC2 automation login tool
#
# Original: http://m.igrs.jp/blog/2013/03/14/ec2-ssh/
# https://gist.github.com/migrs/5157665
# https://gist.github.com/MichinobuMaeda/5545875
#
# Changed by mo-ya (2013-07-06)
#
@vadirajks
vadirajks / debian-init.sh
Created October 28, 2017 11:05 — forked from andsens/debian-init.sh
This is a generic init-script, easily modifiable to suit your needs. It uses quite a lot of lsb init-functions and adheres to the lsb standards.
#!/bin/sh
### BEGIN INIT INFO
# Provides: generic-prog
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Generic Program
# Description: Generic Program is a generic program to do generic things with
### END INIT INFO
@vadirajks
vadirajks / kafka-cheat-sheet.md
Created July 6, 2018 13:04 — forked from sahilsk/kafka-cheat-sheet.md
Apache Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ kafka-topics.sh --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
@vadirajks
vadirajks / aws_rds_mysql_workaround
Created April 21, 2019 12:33
aws_rds_mysql_workaround
Managing the global status history:
CALL mysql.rds_enable_gsh_collector;
CALL mysql.rds_enable_gsh_collector;
CALL mysql.rds_set_gsh_collector(intervalPeriod); (Specifies the interval, in minutes)
CALL mysql.rds_disable_gsh_collector;
CALL mysql.rds_enable_gsh_rotation;
CALL mysql.rds_set_gsh_rotation(intervalPeriod); (Specifies the interval, in days) Default value is 7days
CALL mysql.rds_disable_gsh_rotation;
CALL mysql.rds_collect_global_status_history;
CALL mysql.rds_rotate_global_status_history; (mysql.global_status_history table to mysql.global_status_history_old on demand)
@vadirajks
vadirajks / xenserver_workaround
Created April 29, 2019 04:42
xenserver_workaround
Changing the XenServer Management IP Address
# xe pif-list (uuid)
# xe pif-param-list uuid=e845e047-a2cc-5baa-9389-40300b0d883c (uuid)
# xe pif-reconfigure-ip uuid=e845e047-a2cc-5baa-9389-40300b0d883c mode=static IP=192.168.0.10 netmask=255.255.254.0 gateway=192.168.0.1
@vadirajks
vadirajks / aws_autoscaling_multi_ssh.sh
Created May 4, 2019 11:00 — forked from Ahmadposten/aws_autoscaling_multi_ssh.sh
Use tmux to ssh to all instances of an AWS autoscaling group and execute commands simultaneously.
#!/bin/bash
#
# _ _ _
# ____ | | | | | |
# / __ \ __ _| |__ _ __ ___ __ _ __| |_ __ ___ ___| |_ ___ _ __
# / / _` |/ _` | '_ \| '_ ` _ \ / _` |/ _` | '_ \ / _ \/ __| __/ _ \ '_ \
# | | (_| | (_| | | | | | | | | | (_| | (_| | |_) | (_) \__ \ || __/ | | |
# \ \__,_|\__,_|_| |_|_| |_| |_|\__,_|\__,_| .__/ \___/|___/\__\___|_| |_|
# \____/ | |
# |_|
@vadirajks
vadirajks / aws_autoscaling_workaround
Last active May 4, 2019 13:33
aws_autoscaling_workaround
With each Auto Scaling group, you control when it adds instances (referred to as scaling out) or removes instances (referred to as scaling in).
Launching Auto Scaling Instances in a VPC
Internet Gateways<-VPC(Route Tables)<->Subnets<->ec2
If a subnet's traffic is routed to an internet gateway, the subnet is known as a public subnet.
If a subnet's traffic is not routed to an internet gateway, the subnet is known as a private subnet.
##############################################################################################
Creating a Launch Configuration Using an EC2 Instance
aws autoscaling create-launch-configuration --launch-configuration-name my-lc-from-instance --instance-id i-a8e09d9c
aws autoscaling describe-launch-configurations --launch-configuration-names my-lc-from-instance
Create a Launch Configuration and Override the Block Devices Using the AWS CLI
@vadirajks
vadirajks / linux-cheatsheet.rtf
Created July 13, 2019 07:07 — forked from 101t/linux-cheatsheet.rtf
Comprehensive Linux Cheatsheet
```
____ _ _
/ ___|___ _ __ ___ _ __ _ __ ___| |__ ___ _ __ ___(_)_ _____
| | / _ \| '_ ` _ \| '_ \| '__/ _ \ '_ \ / _ \ '_ \/ __| \ \ / / _ \
| |__| (_) | | | | | | |_) | | | __/ | | | __/ | | \__ \ |\ V / __/
\____\___/|_| |_| |_| .__/|_| \___|_| |_|\___|_| |_|___/_| \_/ \___|
|_|
_ _ ____ _ _ _ _
| | (_)_ __ _ ___ __ / ___| |__ ___ __ _| |_ ___| |__ ___ ___| |_
| | | | '_ \| | | \ \/ / | | | '_ \ / _ \/ _` | __/ __| '_ \ / _ \/ _ \ __|
@vadirajks
vadirajks / python workaround
Last active October 14, 2019 13:00
python workaround
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
installing python 2.6 in RHEL7:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Install fpm
yum install ruby-devel gcc make rpm-build rubygems
gem install --no-ri --no-rdoc fpm
# Install prerequisite to compile Python
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel