Skip to content

Instantly share code, notes, and snippets.

View saxenap's full-sized avatar

Praveen Saxena saxenap

  • West Lafayette, IN
View GitHub Profile
#!/bin/bash
# https://askubuntu.com/a/608960
ss -ant | grep -e "ESTAB" | grep ":22" | tr -s ' ' | cut -d' ' -f5 | cut -d':' -f1
#!/bin/bash
ss -ant | grep -e "ESTAB" | grep ":22" | tr -s ' ' | cut -d' ' -f5 | cut -d':' -f1
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
.PHONY: printvars
printvars:
@$(foreach V,$(sort $(.VARIABLES)), \
$(if $(filter-out environment% default automatic, \
$(origin $V)),$(warning $V=$($V) ($(value $V)))))
#!/bin/bash
curl --silent --location https://rpm.nodesource.com/setup_9.x | sudo bash -
sudo yum -y install nodejs
#!/bin/bash
yum update -y
yum install -y gcc gcc-c++ make
@saxenap
saxenap / gist:8293d0e9e379896d501a8f02cd8b97c0
Created April 21, 2018 18:59 — forked from abhishekkr/gist:4165864
shell.func-download-all-files-from-any-GITHUB-GIST-URL {updated to *new* gist}
# Usage Example: $ ddl-gist 'https://gist.github.com/4137843' ~/Downloads/gists
# save the gist files at that URL in ~/Downloads/gists
##
ddl_gist(){
if [ $# -ne 2 ];
then
echo 'Failed. Syntax: $> ddl-gist GITHUB_GIST_URL DOWNLOAD_PATH'
return
fi
# https://unix.stackexchange.com/questions/220503/how-to-install-dependencies-of-an-rpm-package-without-installing-the-package-its
yum deplist php71 | awk '/provider:/ {print $2}' | sort -u | xargs yum -y install
#!/bin/bash
# requires the correct region set via the cli `aws configure` or in ~/.aws/config
die() { status=$1; shift; echo "FATAL: $*"; exit $status; }
EC2_INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id || die \"wget in$
echo $EC2_INSTANCE_ID
aws ec2 terminate-instances --instance-id $EC2_INSTANCE_ID
#!/bin/bash
getent group www || groupadd www
usermod -a -G www apache
usermod -a -G www ec2-user
chgrp -R www /var/www
chown -R root:www /var/www
find /var/www -type d -exec sudo chmod 2775 {} +
find /var/www -type f -exec sudo chmod 0664 {} +