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 | |
# | |
# Source: http://serverfault.com/a/369430 | |
mysqlconn="mysql -u XXX -p XXX" | |
olddb=XXX | |
newdb=XXX | |
table_names=$($mysqlconn -N -e "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='${olddb}'") |
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
[Unit] | |
Description=Unicorn Server | |
Requires=redis.service | |
Wants=mysqld.service postgresql.service | |
After=redis.service mysqld.service postgresql.service | |
[Service] | |
Type=forking | |
User=netengine | |
WorkingDirectory=/var/www/unicorn/current |
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
[Unit] | |
Description=Puma Server | |
[Service] | |
Type=forking | |
User=netengine | |
WorkingDirectory=/var/www/puma/current | |
Environment=RAILS_ENV=staging | |
SyslogIdentifier=puma | |
PIDFile=/var/www/puma/current/tmp/pids/puma.pid |
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
# letsencrypt.service | |
[Unit] | |
Description=Renew Letsencrypt certificates | |
[Service] | |
Type=simple | |
ExecStart=/usr/bin/letsencrypt renew -n --no-self-upgrade | |
# letsencrypt.timer | |
[Unit] |
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
<!DOCTYPE html> | |
<head> | |
<title>autosizing</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
<style> | |
div { border: 1px solid #aaa; } | |
.w70 { width: 70%; } | |
.w20 { width: 20%; } | |
</style> | |
</head> |
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
# If a second instance of this script starts, it won't run the command and exit with 1. | |
flock -n /tmp/.process-name.lock <long command with args here> |
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 | |
table_name AS `Table`, | |
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` | |
FROM information_schema.TABLES | |
WHERE table_schema = "$DB_NAME" | |
AND table_name = "$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
function (user, context, callback) { | |
var namespace = 'https://example.com/'; | |
context.idToken[namespace + 'first_name'] = user.user_metadata.first_name; | |
context.idToken[namespace + 'last_name'] = user.user_metadata.last_name; | |
context.idToken[namespace + 'mobile_number'] = user.user_metadata.mobile_number; | |
context.idToken[namespace + 'organizations_name'] = user.user_metadata.organizations_name; | |
callback(null, user, context); | |
} |
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
sudo ./certbot-auto certonly --manual -d 'example.com' -d '*.example.com' --agree-tos --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory |
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
DB_CONTAINER="$(docker-compose ps -q pgsql-10.4)" | |
DB_NAME=postgres | |
DB_USER=postgres | |
LOCAL_DUMP_PATH="eeeff09c-9a4f-498a-8098-f38341fc984d.dump" | |
docker-compose up -d ${DB_CONTAINER} | |
docker exec -i "${DB_CONTAINER}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_NAME}" < "${LOCAL_DUMP_PATH}" | |
docker-compose stop ${DB_CONTAINER} |
OlderNewer