Skip to content

Instantly share code, notes, and snippets.

View vadirajks's full-sized avatar

Vadiraj K.S vadirajks

View GitHub Profile
@vadirajks
vadirajks / aws yum workround
Last active September 4, 2019 16:32
aws yum workround
example :
#yumdownloader --source python-psycopg2-2.5.1-3.amzn2.0.2
yum -y install wget bash-completion bash-completion-extras vim screen sysstat chrony
@vadirajks
vadirajks / ssh key
Last active July 30, 2019 11:05
ssh key
ssh-keygen authentication key generation, management and conversion
Generate an RSA SSH keypair with a 4096 bit private key
$ ssh-keygen -t rsa -b 4096 -C "RSA 4096 bit Keys"
Generate an DSA SSH keypair with a 2048 bit private key
$ ssh-keygen -t dsa -b 1024 -C "DSA 1024 bit Keys"
Generate an ECDSA SSH keypair with a 521 bit private key
$ ssh-keygen -t ecdsa -b 521 -C "ECDSA 521 bit Keys"
Generate an ed25519 SSH keypair- this is a new algorithm added in OpenSSH.
$ ssh-keygen -t ed25519
Extracting the public key from an RSA keypair
@vadirajks
vadirajks / install oracle jdk in ubuntu and set env
Created August 6, 2019 11:49
install oracle jdk in ubuntu and set env
sudo alien --scripts jdk-8u144-linux-x64.rpm
sudo alien --scripts jdk-1.7.0_04-fcs.x86_64.rpm
sudo dpkg -i jdk-8u144-linux-x64.rpm
sudo dpkg -i jdk1.8.0-144_1.8.0144-1_amd64.deb
vadiraj@DevOps:~$ cat /etc/profile.d/jdk.sh
#!/bin/bash
unset JAVA_HOME
unset JRE_HOME
export PATH=$(echo $PATH | tr -s ":" "\n" | grep -v java| tr -s "\n" ":")
export PATH=$(echo $PATH | tr -s ":" "\n" | grep -v jvm| tr -s "\n" ":")
@vadirajks
vadirajks / basic elasticsearch 7 setup
Last active May 18, 2022 08:24
basic elasticsearch 7 setup
[root@elasticsearch]# grep -v "^#\|^$" /etc/security/limits.conf
* soft nofile 100000
* hard nofile 100000
* soft sigpending 1032252
* hard sigpending 1032252
* soft memlock unlimited
* hard memlock unlimited
* soft stack unlimited
* hard stack unlimited
* soft nproc unlimited
@vadirajks
vadirajks / sed cheatsheet
Created August 12, 2019 09:29 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
$ aws pricing describe-services \
  --region us-east-1 \
| jq -r '.Services[] | select (.ServiceCode=="AmazonEC2") | .AttributeNames[]' \
| sort
LeaseContractLength
OfferingClass
PurchaseOption
capacitystatus
clockSpeed
@vadirajks
vadirajks / installing necessary packages workaround
Last active August 17, 2019 10:13
installing necessary packages workaround
sudo yum makecache
sudo yum update
sudo yum install epel-release
sudo yum makecache
sudo yum install python-pip
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm
sudo yum install https://$(rpm -E '%{?centos:centos}%{!?centos:rhel}%{rhel}').iuscommunity.org/ius-release.rpm
sudo yum makecache
sudo yum install yum-plugin-replace
sudo yum repolist
@vadirajks
vadirajks / statsd and graphite testing
Last active November 10, 2022 10:53
statsd and graphite testing
$ cat /scripts/graphit_test.sh
#!/bin/bash
#benchmark.statsdtest.random.histograms:${RANDOM} ${epoch}\n \
#benchmark.statsdtest.random.meters:${RANDOM} ${epoch}\n \
#benchmark.statsdtest.random.sets:${RANDOM} ${epoch}\n \
epoch=$(date +%s)
which node || { echo "node missing"; exit 2; }
[ -z "$1" ] && { echo "GRAPHITE_SERVER details missing"; exit 2; }
GRAPHITE_SERVER=$1
GRAPHITE_CARBON_PORT=2003
@vadirajks
vadirajks / kafka workaround
Last active July 19, 2021 07:41
kafka workaround
]# cat zook.sh
epoch=$(date +%s)
for zn in $(zookeepercli --servers zook1,zook2,zook3 -c lsr /); do echo "Znode:$zn" && zookeepercli --servers zook1,zook2,zook3 -c get /$zn ; done | sed '/^$/d' > /tmp/z-$epoch.txt 2>&1
cat /tmp/z-$epoch.txt
]# cat create_topic.sh
/opt/kafka/bin/kafka-topics.sh --delete --zookeeper zook1:2181,zook2:2181,zook3:2181 --topic etopic01
/opt/kafka/bin/kafka-topics.sh --create --zookeeper zook1:2181,zook2:2181,zook3:2181 --replication-factor 1 --partitions 2 --topic etopic01
/opt/kafka/bin/kafka-topics.sh --list --zookeeper zook1:2181,zook2:2181,zook3:2181
/opt/kafka/bin/kafka-configs.sh --alter --zookeeper zook1:2181,zook2:2181,zook3:2181 --entity-type topics --entity-name etopic01 --add-config retention.ms=1000
@vadirajks
vadirajks / xml to json
Created August 25, 2019 10:00
xml to json
]# yum -y install perl-XML-Simple perl-YAML-Syck perl-Data-Dumper
]# cat /custom_scripts/xml2yaml.pl
#!/usr/bin/perl
use XML::Simple;
#use Data::Dumper;
use YAML::Syck;
if( ( not defined $ARGV[0]) or ( $ARGV[0] eq "-h" ) or ( $ARGV[0] eq "--help" ) ) {
print "USAGE: perl xml2yaml.pl file.xml > file.yaml\n";