This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
project_name="Project-ID" | |
echo -e "project_id,dataset_id,table_id,creation_time,last_modified_time,row_count,size_mb,size_gb,type,partiton,partition_expiration_days,cluster_key" > /tmp/bq_out.csv | |
for dataset in $(bq ls|tail -n +3); do | |
bq query --format=csv --use_legacy_sql=false ' | |
SELECT | |
t1.project_id as project_id, | |
t1.dataset_id as dataset_id , | |
t1.table_id as table_id, | |
TIMESTAMP_MILLIS(t1.creation_time) AS creation_time, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SlackChannelName=abc | |
SlackHookURL="abc" | |
MessageBody= | |
MessageTitle="CRITICAL:/aerospike_space_alert.sh [$(hostname)/$(hostname -i)]" | |
AerospikeIP=192.168.0.1:3000 | |
OLDIFS=$IFS; IFS=$'\n' | |
#HWMDisk=60 | |
#HWMMem=75 | |
HWMDisk=55 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@foo:~# rm -rf test; mkdir test; touch test/test{1,2,3}; chown ubuntu test/test1; chown aptly test/test2; ls -al test/ | |
total 8 | |
drwxr-xr-x 2 root root 4096 Nov 30 10:47 . | |
drwx------ 11 root root 4096 Nov 30 10:47 .. | |
-rw-r--r-- 1 ubuntu root 0 Nov 30 10:47 test1 | |
-rw-r--r-- 1 aptly root 0 Nov 30 10:47 test2 | |
-rw-r--r-- 1 root root 0 Nov 30 10:47 test3 | |
root@foo:~# rsync -avz --chown 'nginx:www-data' -e "ssh -i ~/.ssh/my.key" --verbose test root@bar:/tmp/ | |
opening connection using: ssh -i "~/.ssh/my.key" -l root bar rsync --server -vvlogDtprze.iLsfx "--usermap=*:nginx" "--groupmap=*:www-data" . /tmp/ (13 args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
# all traffic, secure or otherwise, comes in on 80 from the ELB | |
listen 80; | |
# ELB stores the protocol used between the client and the load balancer in the X-Forwarded-Proto request header. Check for 'https' and redirect if not | |
if ($http_x_forwarded_proto != 'https') { | |
return 301 https://$host$request_uri; | |
} | |
server_name your-secure-site.com www.your-secure-site.com; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" == "" ] || [ "$2" == "" ]; then | |
echo "Usage: ./reindex.sh [REMOTE_HOST:REMOTE_PORT] [INDEX_PATTERN] [LOCAL_HOST:LOCAL_PORT]" | |
exit 1 | |
fi | |
REMOTE_HOST=$1 | |
PATTERN=$2 | |
if [ "$3" == "" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1> | |
cat /custom-scripts/domain_expire.sh | |
#!/bin/bash | |
target=$1 | |
expdate=$(whois $1 | grep -m1 -oPi '(expir.*date|expir.*on).*\s\K\d.+'.) | |
expdate=$(date -d"$expdate" +%s) | |
curdate=$(date +%s) | |
echo $(((expdate-curdate)/86400)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1> | |
yum install https://github.com/maxmind/mmdbinspect/releases/download/v0.1.1/mmdbinspect_0.1.1_linux_amd64.rpm -y | |
yum install yum install https://github.com/maxmind/geoipupdate/releases/download/v4.9.0/geoipupdate_4.9.0_linux_amd64.rpm http://mirror.centos.org/centos/7/os/x86_64/Packages/GeoIP-1.5.0-14.el7.x86_64.rpm | |
#!/bin/bash | |
in_file=/tmp/bquxjob_56e85de3_180cc776473.csv | |
out_file=${in_file%%.*}-output.csv | |
mv -f ${out_file} ${out_file%%.*}-$(date +%s) 2>/dev/null | |
echo '"user_id","ip_address","country","city"' >> ${out_file} | |
for i in $(cat ${in_file}| grep -v user_id); do | |
details=$(mmdbinspect -db /usr/share/GeoIP/GeoLite2-City.mmdb ${i##*,} | jq "[.[0].Lookup,.[0].Records[0].Record.country.names.en,.[0].Records[0].Record.subdivisions[].names.en]|@csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install epel-release | |
yum install nginx | |
systemctl start nginx | |
systemctl enable nginx | |
systemctl status nginx | |
firewall-cmd --zone=public --permanent --add-service=http | |
firewall-cmd --zone=public --permanent --add-service=https | |
firewall-cmd --reload | |
yum install createrepo yum-utils | |
mkdir -p /var/www/html/repos/<FOLDER>/rhel/x86_64/rpms/{others,production,staging} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm | |
rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm | |
rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7 | |
yum -y remove vim-minimal vim-common vim-enhanced sudo | |
yum -y --enablerepo=gf-plus install vim-enhanced sudo | |
(add it in ~/.vimrc):packloadall | |
mkdir -p ~/.vim/pack/plugins/start | |
git clone --depth=1 https://github.com/vim-airline/vim-airline.git ~/.vim/pack/plugins/start/vim-airline | |
git clone --depth=1 https://github.com/preservim/nerdtree.git ~/.vim/pack/plugins/start/nerdtree | |
git clone --depth=1 https://github.com/airblade/vim-gitgutter.git ~/.vim/pack/plugins/start/vim-gitgutter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# Method 1: Install using rpm packages (credit to DarkMukke) | |
# | |
rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm | |
rpm --import http://mirror.ghettoforge.org/distributions/gf/RPM-GPG-KEY-gf.el7 | |
# WARNING: removing vim-minimal uninstalls `sudo` if you skip the second step | |
# make sure to at least run `yum install sudo` | |
yum -y remove vim-minimal vim-common vim-enhanced |