This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
# apt-get install libio-async-loop-epoll-perl | |
use IO::Async::Loop::Epoll; | |
use IO::Async::Socket; | |
use constant { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
M="admins" | |
L="/tmp/hg2mirror.log" | |
E="/tmp/hg2mirror.err" | |
TOPDIR="/var/www/rhodecode/" | |
try_mercurial() { | |
test -d "$1/.hg" || return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
( df -h | tail -n +2 | |
df -i | tail -n +2 | |
awk '/^\/vz/ {print $2}' /proc/mounts | xargs -r df -h | tail -n +2 | |
awk '/^\/vz/ {print $2}' /proc/mounts | xargs -r df -i | tail -n +2 | |
) | grep -v ^none | egrep -v ' [ 1234567 ][0-9]% ' | sort | uniq \ | |
| mail -E -s 'Check-df warning' admins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
test $# = 2 || test $# = 3 || { echo "Usage: $0 start-time end-time [dest-folder]"; exit; } | |
Fail() { echo "ERROR: $@" 1>&2; exit 1; } | |
NOW="$(date +%s)" | |
START="$(date +%s -d "$1" 2>/dev/null)"; test -z "$START" && Fail "wrong start-time: $1" | |
FINISH="$(date +%s -d "$2" 2>/dev/null)"; test -z "$FINISH" && Fail "wrong end-time: $2" | |
DESTDIR="$3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CTID="123" | |
NAME="mysite" | |
HOSTNAME="mysite.org" | |
IPADDR="1.2.3.4" | |
OLD_IPADDR="5.6.7.8" | |
SRCHOST="[email protected]::RootDir" | |
export RSYNC_PASSWORD="JustPassMe" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BASEDIR="/var/lib/mysqlbackup" | |
TSTAMP="$(date +%Y.%m.%d_%H%M%S)" | |
DESTDIR="$BASEDIR/new" | |
PREVDIR="$BASEDIR/full" | |
LOGSDIR="$BASEDIR/logs" | |
LOGFILE="$LOGSDIR/$TSTAMP.log" | |
Fail() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
Fail() { | |
logger -p "user.err" -t "rsnap" -s "$@"; | |
#echo "$@" | mail -s "rsnap failed on $(hostname -f)" admins | |
exit 1 | |
} | |
#====== Parse command line ================================= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
IP="/sbin/ip" | |
EXT_IFACE="$($IP route get 8.8.8.8 | grep ' src ' | sed -e 's,.* dev ,,' -e 's, .*,,')" | |
EXT_IPADDR="$($IP addr ls dev $EXT_IFACE | grep ' inet ' | sed -e 's,.* inet ,,' -e 's,/.*,,')" | |
# Default filter policy.. | |
iptables -P INPUT ACCEPT | |
iptables -P OUTPUT ACCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov [email protected] 2012 | |
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler" | |
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist | |
(function(host) { | |
function Crawler() { | |
this.visitedURLs = {}; | |
}; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# http://vk.com/wall403284_81744 | |
SRCURL="http://transport.orgp.spb.ru/Portal/transport/internalapi/gtfs/realtime/vehicle?bbox=30.32,59.84,30.33,59.85&transports=bus,trolley,tram,ship&routeIDs=1329" | |
DESTURL="ftp://volokhonsky:[email protected]/folder1" | |
MAILTO="[email protected]" | |
MYNAME="${0##*/}" | |
LOGFILE="/tmp/$MYNAME.log" | |
FNAME="$(date +%Y-%m-%d_%H%M%S).bin" |