Skip to content

Instantly share code, notes, and snippets.

View vadirajks's full-sized avatar

Vadiraj K.S vadirajks

View GitHub Profile
$ 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 / 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";
@vadirajks
vadirajks / postman-deb.sh
Created September 2, 2019 13:14 — forked from SanderTheDragon/postman-deb.sh
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
ls Postman*.tar.gz > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Removing old Postman tarballs"
rm -f $(ls Postman*.tar.gz)
fi
echo "Downloading latest Postman tarball"
curlExists=$(command -v curl)
@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 / xev vm backup
Created September 24, 2019 05:57
xev vm backup
[root@xen-R9-dev49-0 env]# cat vm_backupexport.sh
#!/bin/bash
eval array=($(xe vm-list params=uuid is-control-domain=false|grep "uuid"|cut -c 17-))
for uuid in "${array[@]}"; do
vm_name=$(xe vm-list params=name-label uuid=$uuid|grep "name-label"|cut -c 23-)
echo "xe vm-export vm='"$uuid"' filename="$vm_name".xva"
#xe vm-export vm=$uuid filename=$vm_name.xva
done
[root@xen-R9-dev49-0 env]#
[root@xen-R9-dev49-0 env]# cat vm_details.sh
@vadirajks
vadirajks / typing arrows in plain text
Created October 6, 2019 12:14
typing arrows in plain text
Type arrows by copy/pasting the following Unicode characters:
arrows ↑ ↓ ← →
diagonal arrows ↖ ↗ ↘ ↙
The keyboard HTML entity character codes are: ↑ ↓ ← →
HTML entities for mdash and ndash (for long dashes): — –
HTML entities for less than and greater than characters: < >
@vadirajks
vadirajks / Extending a Linux File System After Resizing a Volume
Created October 8, 2019 10:55
Extending a Linux File System After Resizing a Volume
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
https://docs.aws.amazon.com/en_pv/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
disk Type:
Nitro-based Instance:/dev/nvme[0-26]n1[p1...]->(0-26 Disk Number,[p1...] is Partition Number)
Identifying the File System for a Volume:
[ec2-user ~]$ df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
devtmpfs devtmpfs 1878928 0 1878928 0% /dev
@vadirajks
vadirajks / xml workaround
Last active October 14, 2019 12:31
xml workaround
Xmllint
$ sudo apt install libxml2-utils
$ sudo yum install libxml2-utils
$ xmllint --format data
Xml_pp:
$ sudo apt install libxml2-utils
$ sudo yum install libxml2-utils
$ xmllint --format data
@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