Skip to content

Instantly share code, notes, and snippets.

View eignatov's full-sized avatar
💻
typing...

eignatov

💻
typing...
View GitHub Profile
@eignatov
eignatov / postgres_ftp_backup.sh
Created February 5, 2020 19:41 — forked from cschell/postgres_ftp_backup.sh
Backup gziped postgresql dump to a ftp server
# shell command:
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+%Y-%m-%d_%H-%M'`/db_backup.sql.gz --ftp-create-dirs -T -
# if you want to execute it through cron, be sure to escape all %!
# for crontab:
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+\%Y-\%m-\%d_\%H-\%M'`/db_backup.sql.gz --ftp-create-dirs -T -
@eignatov
eignatov / delete_old_backups.sh
Created February 5, 2020 19:41 — forked from cschell/delete_old_backups.sh
Delete backups that are x days old (from ftp server)
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+%Y-%m-%d_'`*; exit"
# make sure to escape % for cron:
lftp -u <ftp_user>,<ftp_password> <ftp_host> -e "rm -rf `date --date="3 days ago" '+\%Y-\%m-\%d_'`*; exit"
#!/bin/bash
# the source: http://serverfault.com/questions/515833/how-to-remove-private-key-password-from-pkcs12-container
if [ $# -ne 2 ]
then
echo "Usage: `basename $0` YourPKCSFile YourPKCSPassword"
exit $E_BADARGS
fi
@eignatov
eignatov / curl_create_repo_github
Created December 11, 2017 10:42 — forked from chrisross/curl_create_repo_github
A set of shell commands to quickly remotely create a github repo, init/add all/commit in the current directory and push to the aforementioned remote. (using Github's Repo API v3 and cURL)
curl -u <username_here> https://api.github.com/user/repos -d '{"name":"curltest", "description": "testing description"}'
=> Enter passphrase:
// Example test case(below):
cd <local_repo_dir_path>
mkdir curltest
cd curltest
git init
touch curltest.txt
subl& culrtest.txt
@eignatov
eignatov / install-ispconfig3-centos.sh
Created November 16, 2017 17:58
Install ISPConfig3 CentOS 7 64Bits
#!/bin/bash
## Install ISPConfig 3.x on CentOS 7 64Bits
## http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-centos.html
## https://www.howtoforge.com/tutorial/perfect-server-centos-7-2-apache-mysql-php-pureftpd-postfix-dovecot-and-ispconfig/2/
## http://nareshv.blogspot.com.br/2014/02/configure-hhvm-with-apache-fastcgi-on.html
## ISPConfig3 3.x + Apache2 + CentOS 7 64Bits
## VM HD 50GB, swap 2GB, / 19GB, /var/www all
## Filesystem ext4
## Run as root
# Copied from http://ttaportal.org/wp-content/uploads/2012/10/7-Reallocation-using-LVM.pdf
##
## Showing the problem: need to reallocate 32GB from /dev/mapper/pve-data to /dev/mapper/pve-root
##
df -h
# Filesystem Size Used Avail Use% Mounted on
# /dev/mapper/pve-root 37G 37G 0 100% /
# tmpfs 2.0G 0 2.0G 0% /lib/init/rw
@eignatov
eignatov / OVH_README.md
Created August 31, 2016 10:56 — forked from Trefex/OVH_README.md
How I setup my VPS on ovh-com

Config is 2vCPU, 2 GB RAM and running Debian 7 on 64 bits.

apt-get update
apt-get upgrade
apt-get install htop

Add localadmin user

adduser localadmin

apt-get install sudo

@eignatov
eignatov / comodo-ssl-cer-pem.sh
Created March 17, 2016 19:21 — forked from genediazjr/comodo-ssl.sh
Convert Comodo Positivessl to cer and pem
# generate OpenSSL CSR here
# https://www.digicert.com/easy-csr/openssl.htm
# to cer
cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > yourdomain.com.cer
# to pem
cat yourdomain.com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt yourdomain.com.key > yourdomain.com.pem
@eignatov
eignatov / nginx.conf
Created January 26, 2016 14:08
My general Nginx config
# user http;
# user www-data;
worker_processes 4;
# [ debug | info | notice | warn | error | crit ]
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;
@eignatov
eignatov / nginx.conf
Created January 26, 2016 13:51
Nginnx config for Yii 2 Advanced App Template (subdomains)
# frontend
server {
listen 80;
server_name yii2.lo;
server_tokens off;
client_max_body_size 128M;
charset utf-8;
access_log /var/log/nginx/yii2-access.log main buffer=50k;