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
mysql> select * from d1.t1; | |
+----+ | |
| id | | |
+----+ | |
| 1 | | |
| 2 | | |
| 3 | | |
+----+ | |
5 rows in set (0.00 sec) |
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 | |
set -eux | |
MYSQL_HOST='' | |
MYSQL_USER='' | |
MYSQL_PASS='' | |
EXEC_MYSQL="docker run -e MYSQL_PWD=${MYSQL_PASS} -it --rm mysql:5.6 mysql" | |
EXEC_MYSQLBINLOG="docker run -e MYSQL_PWD=${MYSQL_PASS} -v ${PWD}:/dump -it --rm mysql:5.6 mysqlbinlog" |
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 | |
DB_NAME=( "db1" "db2" ) | |
for db_name in "${DB_NAME[@]}"; do | |
for table in $( mysql --login-path=luis_ro -D ${db_name} -Bse "show tables" ); do | |
mysql --login-path=luis_rw -D ${db_name} -Bse "analyze table $table"; | |
done | |
done |
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
System-wide power settings: | |
Currently in use: | |
lidwake 1 | |
autopoweroff 1 | |
standbydelayhigh 86400 | |
autopoweroffdelay 28800 | |
proximitywake 1 | |
standby 1 | |
standbydelaylow 10800 | |
ttyskeepawake 1 |
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 | |
while : | |
do | |
redis-cli -h fqdn -a password ping | grep PONG | |
if [ $? -eq 0 ]; then | |
echo "ok" | |
else | |
echo "ng" | |
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
SELECT DISTINCT | |
t.table_name, | |
column_name, | |
column_type, | |
table_rows, | |
(stat_value * @@innodb_page_size) / 1024 / 1024 AS index_size_mb | |
FROM | |
information_schema.tables t | |
LEFT JOIN information_schema.columns c | |
ON c.table_name = t.table_name |
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 | |
set -eu | |
readonly CLUSTERS=( $( orchestrator -c clusters ) ) | |
function can_replicate { | |
for cluster in "${CLUSTERS[@]}" | |
do | |
replicas=( $( orchestrator -c which-replicas -i "${cluster}") ) |
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 | |
# | |
# generate static files from wordpress, deploy to S3, clear cache of CloudFront. | |
set -u | |
readonly BASE_DIR="/mnt/efs/DocumentRoot" | |
readonly S3_BUCKET="" | |
readonly CF_DISTRIBUTION_ID="" | |
readonly WP_UPLOAD_DIR="${BASE_DIR}/wp-content/uploads" |
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 | |
set -eu | |
ids=( $( mkr hosts | jq -r '.[].id' ) ) | |
for id in "${ids[@]}"; | |
do | |
mkr retire --force ${id} | |
done |
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 | |
set -e | |
cf_ips() { | |
echo "# https://www.cloudflare.com/ips" | |
echo 'geo $realip_remote_addr $cf {' | |
echo -e "\tdefault 0;" | |
for type in v4 v6; do | |
echo -e "\t# IP$type" |
NewerOlder