Skip to content

Instantly share code, notes, and snippets.

@overplumbum
overplumbum / gist:2764300
Created May 21, 2012 19:58
URL average speed by hour from nginx access log
zcat /var/log/nginx/prod.*.access.log-2012051[567].gz | grep autocomplete | perl -nle 'm|(\d+)/.../....:(\d+):.* "([0-9.]+)" "ostrovok.ru" "ajax"| and print "$1$2 $3"' | awk '{a[$1]++;b[$1]=b[$1]+$2}END{for (i in a) printf("%s\t%10.2f\n", i, b[i]/a[i])} ' | sort
@overplumbum
overplumbum / netgear_status.py
Created April 10, 2012 11:12
NetGear WiFi Router Monitoring
#!/usr/bin/env python
import urllib2, argparse
parser = argparse.ArgumentParser()
parser.add_argument('-H', required=True)
parser.add_argument('-U', default='admin')
parser.add_argument('-P', default='password')
args = parser.parse_args()
fields = "an_rxbs an_txbs bgn_rxbs bgn_txbs lan_rxbs lan_txbs".split(' ')
@overplumbum
overplumbum / gist:2284823
Created April 2, 2012 16:32
phppgadmin hosts
diff --git a/database.php b/database.php
index 95cdf2b..de5ef19 100755
--- a/database.php
+++ b/database.php
@@ -400,6 +400,27 @@
echo "</div>";
}
+
+ function clientResolve($addr) {
@overplumbum
overplumbum / gist:1349878
Created November 9, 2011 00:36
Pg Table Sync
-- DROP FUNCTION table_sync(regclass, regclass);
CREATE OR REPLACE FUNCTION table_sync(in_source regclass, in_destination regclass)
RETURNS void AS
$BODY$DECLARE
_pk name[];
_data name[];
_all name[];
_pk_ident text;
@overplumbum
overplumbum / gist:1237114
Last active December 6, 2022 12:46
PostgreSQL tables sizes with related TOAST tables
SELECT E'{| border=1 cellspacing=0 cellpadding=5\n|+\n|тип || relation || size || чей toast || mantainer || планы\n|-\n' || array_to_string(ARRAY(
SELECT '|' || C.relkind ||
'||' || nspname || '.' || C.relname ||
'||' || pg_size_pretty(pg_relation_size(C.oid)) ||
'||' || COALESCE(T.relname, '-') ||
'||' || '/author/' ||
'||' || '/wtf?/' || E'\n|-'
/*SELECT C.relkind, nspname || '.' || C.relname AS "relation",
@overplumbum
overplumbum / video-from-frames.sh
Last active September 27, 2015 04:08
Video clip from frames generation
## Windows: http://en.cze.cz/Images-to-video
## MacOSX & Linux below
clipdir=/tmp/clip/
rm -fr $clipdir && mkdir $clipdir
# crop&resize 3x4 frames to 16x9 1280x720
for i in *.JPG ; do convert -verbose $i -strip -resample 72x72 -crop x1386+0+100 -resize 1280x $clipdir/$i ; done
#:> cmds.lst && for i in *.JPG ; do echo convert -verbose $i -strip -resample 72x72 -crop x1386+0+100 -resize 1280x $clipdir/$i >> cmds.lst ; done