Skip to content

Instantly share code, notes, and snippets.

Avatar

Grigory grigory-v

View GitHub Profile
@grigory-v
grigory-v / gist:19e3ee5dd6e2a1294fcc
Created Feb 3, 2016
RaspberryPi backup with dd
View gist:19e3ee5dd6e2a1294fcc
# source: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=46911
# backup
sudo dd bs=4M if=/dev/sdd | gzip > raspbian-`date +%d%m%y`.img.gz
# restore
gzip -dc image.gz | sudo dd bs=4M of=/dev/sdd
@grigory-v
grigory-v / backup-host.sh
Last active Nov 21, 2019
Backup with duplicity to yandex.disk
View backup-host.sh
#!/bin/sh
# Duplicity wrapper
#
# Not working for now. Yandex prevents uploading lagre files via webdav.
# add to crontab:
# 0 0 * * * /bin/sh /usr/local/sbin/backup-host.sh
set -e
@grigory-v
grigory-v / postgres-backup.sh
Last active Aug 12, 2016
Backup postgres users dbs to email
View postgres-backup.sh
#!/bin/bash
export PATH=$PATH:/usr/bin:/usr/sbin
export RECIPIENTS='example@mail.org, example2@mail.org'
export FROM='admin'
# Setup passwords in /root/.pgpass
export BACKUP_USERS='django postgres'
@grigory-v
grigory-v / kazoo_connect.py
Created Aug 11, 2014
Forever retry reconnection every 6 seconds for kazoo
View kazoo_connect.py
from kazoo.client import KazooClient
from kazoo.retry import KazooRetry
retry = KazooRetry(max_tries=-1, max_delay=6)
zk = KazooClient(hosts='127.0.0.1:2181', connection_retry=retry)
zk.start(timeout=None)