View zfsinstall-1-setup.sh
#!/bin/bash | |
# Check before running, may need intervention | |
# Pass in the following to the script, or hardcode it. | |
# Uncomment if hardcoding input. | |
BOOT_PARTITION="/dev/sdg1" | |
DISK_1="ata-SanDisk_SDSSDXPS480G_152271401093" | |
DISK_2="ata-SanDisk_SDSSDXPS480G_154501401266" | |
POOL="vault" |
View mysql-docker.sh
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
View Backup, restore postgres in docker container
Backup: | |
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql | |
Restore: | |
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres |
View nginx.conf
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
View cloudflare-failover.sh
#!/bin/bash | |
# Copyright (C) 2016 Arash Shams <https://github.com/Ara4Sh>. | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
View ddns.sh
#!/usr/bin/env bash | |
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your API token is here: https://www.cloudflare.com/a/account/my-account | |
# Make sure the token is the Global token, or has these permissions: #zone:read, #dns_record:read, #dns_records:edit | |
# Step 2: Create an A record on Cloudflare with the subdomain you chose | |
# Step 3: Run "./ddns.sh -l" to get the zone_id and rec_id of the record you created. | |
# Fill in ZONE_ID and REC_ID below | |
# This step is optional, but will save you 2 requests every time you this script | |
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating. | |
# Step 5: Run it every hour with cron. Use the '-s' flag to silence normal output |
View haproxy-cloudflare
acl from_cf src -f /etc/haproxy/cf-ips-v4 | |
reqidel ^X-Forwarded-For:.* if ! LOCALHOST | |
reqirep ^CF-Connecting-IP:(.*)$ X-Forwarded-For:\1 if from_cf | |
option forwardfor if-none |
View repo-full-copy.sh
# Клонируем исходный репозиторий без рабочего каталога (--bare) | |
git clone --bare https://github.com/exampleuser/old-repository.git | |
cd old-repository.git | |
# Делаем mirror-push(будут скопированы все ветки и тэги) в новый репозиторий | |
git push --mirror https://github.com/exampleuser/new-repository.git | |
cd .. | |
# Удаляем папку с репозиторием |