Skip to content

Instantly share code, notes, and snippets.

@altif227
altif227 / autopgsqlbackup
Created April 1, 2019 10:21 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <[email protected]>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@altif227
altif227 / installAndConfigureTomcat8.sh
Created December 10, 2018 13:47
Install and configure Tomcat8 on an Amazon Linux AMI using Java OpenJDK 1.8 that starts on reboot.
#!/bin/bash
mkdir /opt/tomcat
yum update -y
yum install java-1.8.0-openjdk-devel httpd24 git -y
service httpd start
chkconfig httpd on
yum remove java-1.7.0-openjdk -y
# calling the version may ensure that java recognizes 1.8 as the new defaut
java -version
echo "JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk/jre" | \
@altif227
altif227 / accept_known_hosts.sh
Created November 28, 2018 13:22 — forked from FelikZ/accept_known_hosts.sh
Fix known_hosts file "Jenkins Host key verification failed"
#!/bin/bash
for domain in "github.com" "bitbucket.org"; do
echo $domain
sed -i "/$domain/d" ~/.ssh/known_hosts
line=$(ssh-keyscan $domain,`nslookup $domain | awk '/^Address: / { print $2 ; exit }'`)
echo $line >> ~/.ssh/known_hosts
done
@altif227
altif227 / Install bash-completion on Amazon Linux
Created November 24, 2018 19:11 — forked from dasgoll/Install bash-completion on Amazon Linux
Install bash-completion on Amazon Linux
## Install bash-completion on Amazon Linux
wget http://www.caliban.org/files/redhat/RPMS/noarch/bash-completion-20060301-1.noarch.rpm
rpm -ivh bash-completion-20060301-1.noarch.rpm
. /etc/bash_completion
@altif227
altif227 / postgres_queries_and_commands.sql
Created November 21, 2018 06:38 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'