Skip to content

Instantly share code, notes, and snippets.

View ilyaevseev's full-sized avatar

Ilya Evseev ilyaevseev

  • Loyaltyplant.com
  • Nazareth, Israel
  • 04:20 (UTC +03:00)
  • LinkedIn in/ilyaevseev
View GitHub Profile
@ilyaevseev
ilyaevseev / redmine_database_backup
Last active August 29, 2015 14:03
Redmine_database_backup
#!/bin/sh
#
# /etc/cron.daily/redmine_database_backup
#
# Works under Debian/Ubuntu
#
MAIL_TO="admins" # ..see also /etc/aliases
REDMINE_CONFIG="/etc/redmine/default/database.yml"
MYSQL_CONFIG="/etc/mysql/debian.cnf"
DESTDIR="/home/redmine_backups"
@ilyaevseev
ilyaevseev / ubuntu_12.04_to_14.04_lts.md
Last active August 29, 2015 14:05
Notes about upgrading Ubuntu from 12.04 to 14.04
@ilyaevseev
ilyaevseev / domaincheck-cronhourly.sh
Last active May 3, 2016 07:35
Domaincheck -- alert on DNS domain info changing.
#!/bin/sh
(
cd /usr/local/domaincheck || exit 1
mkdir -p state logs || exit 1
./domaincheck domains.txt state > logs/$(date +%Y%m%d-%H%M%S).log 2>&1
find logs/ -type f -name '*.log' -mtime +30 -delete
@ilyaevseev
ilyaevseev / smokeping_mtr.pl
Created September 1, 2014 09:42
MTR handler for SmokePing
#!/usr/bin/perl
# http://www.mail-archive.com/smokeping-users@lists.oetiker.ch/msg04048.html
# this script would be run when smokeping detects some loss. The
# smokeping trigger could look like:
#
# +highLossTwice
# type = loss
# pattern = >70%,>70%
@ilyaevseev
ilyaevseev / push2mercurial.sh
Created September 4, 2014 08:08
Backup changed data to remote Mercurial repositories -- /etc/cron.daily/push2mercurial skeleton.
#!/bin/sh
WEBAPP_BASEDIR="/home/webapp"
HGSERVER_URI="http://webserv1:VerySecretPassword@mercurial.example.ru:5000"
Push0() {
local o="/tmp/$2.log"
local e="/tmp/$2.err"
(
cd "$1"
@ilyaevseev
ilyaevseev / mysql-dump-all-databases.sh
Last active February 8, 2016 00:23
/etc/cron.daily/Dump-All-Databases for Debian/Ubuntu/MySQL/Postgres.
#!/bin/sh
TSTAMP="$(LANG=C date +%Y.%m.%d_%H%M%S)"
DIR="/var/lib/mysqldump"
LOG="$DIR/log-$TSTAMP.log"
DUMP="$DIR/dump_all_databases.sql"
Fail() { logger "$0: $@"; echo "$@" | mail -s "mysqldump failed" admins; exit 1; }
mkdir -p "$DIR" || Fail "Mkdir $DIR failed."
@ilyaevseev
ilyaevseev / webldappasswd.pl
Last active August 29, 2015 14:06
Change LDAP passwords via simple Web-based form. Rewritten from PHP to Perl, tested with 389-DS.
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
my $cgi = new CGI;
my $textTitle = 'Change LDAP password';
my $textHeader = 'Change your LDAP password';
@ilyaevseev
ilyaevseev / maxrandr.sh
Created September 27, 2014 04:40
One-liner for setting maximum available X11 display resolution using xrandr.
#!/bin/sh
xrandr | perl -ne '
BEGIN { my ($x, $y) = (0, 0) }
END { printf "%sx%s\n", $x, $y if $x and $y }
/^\s+(\d+)x(\d+)\s+\d/ && ($1 + $2 > $x + $y) && (($x, $y) = ($1, $2));
' | xargs -r xrandr -s
@ilyaevseev
ilyaevseev / README.md
Last active August 29, 2015 14:12
Backup filelist to Mercurial repository.

configs2git

Copies selected configs to Git or Hg repository. It is better than track entire /etc with tons of garbage.

Example:

Prepare once:

echo '
/boot/grub/grub.cfg
#!/bin/sh
#
# Generate index page and thumbnail pictures
# for all GIF/JPG/PNG/... stuff in current directory.
#
THUMBDIR=thumbnails
THUMBSIZE=160x120
INDEX=index.html
INDEX0=index.inc