Skip to content

Instantly share code, notes, and snippets.

@ilyaevseev
ilyaevseev / deb2diffs.sh
Last active Aug 29, 2015
For given deb-package, creates list of changed files and line-by-line diff.
View deb2diffs.sh
#!/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; }
View sphinxapi.php-SetFilterFloatRange.diff
--- 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 Aug 29, 2015
Find connectivity failures in collectd reports.
View pingcsv2stat.pl
#!/usr/bin/perl
use strict;
use warnings;
my $MIN_DELTA = 120;
my $nan;
my $last_good;
@ilyaevseev
ilyaevseev / redmine_database_backup
Last active Aug 29, 2015
Redmine_database_backup
View 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 Aug 29, 2015
Notes about upgrading Ubuntu from 12.04 to 14.04
View ubuntu_12.04_to_14.04_lts.md
@ilyaevseev
ilyaevseev / smokeping_mtr.pl
Created Sep 1, 2014
MTR handler for SmokePing
View smokeping_mtr.pl
#!/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 Sep 4, 2014
Backup changed data to remote Mercurial repositories -- /etc/cron.daily/push2mercurial skeleton.
View push2mercurial.sh
#!/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 Aug 29, 2015
Change LDAP passwords via simple Web-based form. Rewritten from PHP to Perl, tested with 389-DS.
View webldappasswd.pl
#!/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 Sep 27, 2014
One-liner for setting maximum available X11 display resolution using xrandr.
View maxrandr.sh
#!/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 Aug 29, 2015
Backup filelist to Mercurial repository.
View README.md

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