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
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md | |
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192 | |
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB. | |
------------ | |
-- Basics -- | |
------------ | |
-- Get indexes of tables (postgres tables excluded) |
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
#!/usr/bin/env bash | |
cron_line="<cron line to search for>" | |
cronjob=`crontab -l | grep "$cron_line"` | |
if [[ -z $cronjob ]] | |
then | |
crontab -l > /tmp/mycron | |
echo -e "\n$cron_line" >> /tmp/mycron | |
crontab /tmp/mycron |
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
#!/usr/bin/env bash | |
if find $1 -maxdepth 0 -empty | read v; then echo 1; else echo 0 ; fi |
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 | |
gracedays=90 | |
# get domain names from a file | |
# a domain at each line | |
domain_file="domains.txt" | |
cat $domain_file | while read -a domains; | |
do | |
server=${domains[0]} |
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
#!/usr/bin/env bash | |
#check_str=`grep "Advancity Server Performance Tuning Parameters" /etc/sysctl.conf` | |
#if [[ ! -z $check_str ]]; then echo 'Configuration already made in /etc/sysctl.conf'; exit; fi; | |
sysctl -a | grep -P "fs.file-max\ | |
|net.ipv4.tcp_max_orphans|net.ipv4.tcp_no_metrics_save|net.ipv4.tcp_window_scaling\ | |
|net.ipv4.tcp_timestamps|net.ipv4.tcp_sack|net.ipv4.tcp_max_syn_backlog|\ | |
net.ipv4.tcp_congestion_control|net.ipv4.tcp_mtu_probing|net.ipv4.tcp_synack_retries|\ | |
net.ipv4.ip_local_port_range|net.ipv4.tcp_rfc1337|net.ipv4.tcp_fin_timeout|\ | |
net.core.somaxconn|net.core.netdev_max_backlog|net.core.optmem_max|net.ipv4.tcp_mem|\ |
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
crontab -l > /tmp/mycron | |
tee -a /tmp/mycron <<EOF | |
# restart wowza | |
0 1 * * * /bin/systemctl restart WowzaStreamingEngine | |
# free cache | |
*/1 * * * * /opt/advancity/bin/free_mem_cache.sh | |
# rclone | |
@reboot /opt/advancity/bin/stream_mover_perculusplus.sh | |
@reboot sleep 10 && /usr/local/bin/docker-compose -f /perculusdata/perculus-setup/perculus/docker-compose.yml up -d |
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
USE master | |
SELECT MyInt = CONVERT(BIGINT, o1.object_id) + CONVERT(BIGINT, o2.object_id) + CONVERT(BIGINT, o3.object_id) | |
INTO #temp | |
FROM sys.objects o1 | |
JOIN sys.objects o2 ON o1.object_id < o2.object_id | |
JOIN sys.objects o3 ON o1.object_id < o3.object_id | |
SELECT SUM(CONVERT(BIGINT, o1.MyInt) + CONVERT(BIGINT, o2.MyInt)) | |
FROM #temp o1 |
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
domain=$1 | |
ips="$(nslookup $1 | grep -zoP "Non-authoritative(.|\n)+" | grep -aPo "\d+\.\d+\.\d+\.\d+")"; | |
# echo $ips; | |
for ip in $ips; do | |
echo "Checking $domain on $ip"; | |
curl --resolve $domain:443:$ip https://$domain -s -S > /dev/null | |
curl --verbose --resolve $domain:443:$ip https://$domain 2>&1 | grep -E "expire" |
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
sh -c "truncate -s 0 /var/lib/docker/containers/*/*-json.log" | |
echo '{ "log-driver": "json-file", "log-opts": {"max-size": "100m", "max-file": "3"} }' &> /etc/docker/daemon.json | |
sudo sh -c "truncate -s 0 /var/lib/docker/containers/*/*-json.log" | |
systemctl reload docker | |
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
df | awk '{if($2 > 30000000 && $6 !~ "/var") {print $6}}' |