Skip to content

Instantly share code, notes, and snippets.

View ilyaevseev's full-sized avatar

Ilya Evseev ilyaevseev

  • Loyaltyplant.com
  • Nazareth, Israel
  • 10:30 (UTC +03:00)
  • LinkedIn in/ilyaevseev
View GitHub Profile
@ilyaevseev
ilyaevseev / deb2diffs.sh
Last active August 29, 2015 13:56
For given deb-package, creates list of changed files and line-by-line diff.
#!/bin/sh
Install_me_so='
apt-get install debsums
wget -O /usr/local/bin/deb2diffs https://gist.github.com/ilyaevseev/8818910/raw/67677ef6324554f51aea390e39597ad97140d3de/deb2diffs.sh
chmod +x /usr/local/bin/deb2diffs
'
#set -x
Fail() { echo "$@" 1>&2; exit 1; }
--- sphinxapi.php.orig 2013-07-02 00:55:44.000000000 +0200
+++ sphinxapi.php 2014-03-21 11:52:10.000000000 +0100
@@ -847,2 +847,2 @@
- assert ( is_float($min) );
- assert ( is_float($max) );
+ assert ( is_float($min) || is_numeric($min) );
+ assert ( is_float($max) || is_numeric($max) );
@ilyaevseev
ilyaevseev / pingcsv2stat.pl
Last active August 29, 2015 13:58
Find connectivity failures in collectd reports.
#!/usr/bin/perl
use strict;
use warnings;
my $MIN_DELTA = 120;
my $nan;
my $last_good;
@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 / 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 / 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