Skip to content

Instantly share code, notes, and snippets.

Avatar

Артем zveronline

View GitHub Profile
@zveronline
zveronline / zfsinstall-1-setup.sh
Created Sep 10, 2018 — forked from johnramsden/zfsinstall-1-setup.sh
Install scripts for installing Arch Linux on ZFS. Not runnable, just listed commands.
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"
@zveronline
zveronline / mysql-docker.sh
Created Aug 15, 2018 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
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
@zveronline
zveronline / nginx.conf
Created Jan 1, 2018 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@zveronline
zveronline / cloudflare-failover.sh
Last active Jan 29, 2018 — forked from Ara4Sh/cloudflare-failover.sh
CloudFlare A records failover script using CloudFlare api v4 (https://api.cloudflare.com) required jq and curl to run.
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
@zveronline
zveronline / ddns.sh
Created Dec 25, 2017 — forked from lyoshenka/ddns.sh
Quick and dirty DDNS using Bash and Cloudflare (API v4 compatible)
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
@zveronline
zveronline / haproxy-cloudflare
Last active May 17, 2019 — forked from sielay/gist:0aa4077829f35f5e0310f9e0cc9fdc71
Haproxy - Capture client IP when behind CloudFlare or not. Also keep x-forwarded-for in logs
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
@zveronline
zveronline / repo-full-copy.sh
Created Dec 27, 2016 — forked from gaech/repo-full-copy.sh
Полный перенос git репозитория на другой сервер
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 ..
# Удаляем папку с репозиторием
You can’t perform that action at this time.