--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/disk_io_stat.pl Wed May 07 16:25:00 2014 +0200
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+# disk stat thru sys/block/<dev>stats
+
+$fbase = "/sys/block/";
+$devpattern = qr#^$base(dm-\d+|sd.+)$#i;
+
+$sleep = 1;
+
+%nodiff = ( 8 => 1 );
+
+@header = qw ( dev r-io r-merge r-sect r-tick w-io w-merge w-sect w-tick inflight iotick timeinQ );
+
+@devs = grep { s/^\s+|\s+$//g,1 } grep { /$devpattern/ } qx( ls $fbase );
+
+while( 1 ) {
+ print chr(27), "[2J", chr(27), '[f';
+ foreach $h (@header) {
+ printf "%-12s ", $h;
+ }
+ print "\n";
+
+ for $i ( 0 .. $#devs ) {
+ $s = qx( cat $fbase$devs[$i]/stat ); chomp $s; $s =~ s/^\s+|\s+$//g;
+ @a = split /\s+/, $s;
+
+ print $devs[$i], "\t";
+ for $j ( 0 .. $#a ) {
+ if( $nodiff{$j} ) {
+ printf "%12i;", $a[$j];
+
+ } else {
+ printf "%12i ", $a[$j] - $prev[$i][$j];
+ $prev[$i][$j] = $a[$j];
+ }
+ }
+ print "\n";
+ }
+
+ sleep $sleep;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/exif_rename.pl Wed May 07 16:25:00 2014 +0200
@@ -0,0 +1,109 @@
+#!/usr/bin/perl -w
+#
+# set date from exif info
+# $Id: exif_rename.pl 208 2003-09-15 12:24:09Z grin $
+#
+# (c)2003, Peter Gervai
+#
+
+
+use POSIX qw( strftime );
+
+my $exifprog="exiftags";
+my $filepattern = qr/^(.+)\.jpg/i;
+my $FNAME = "pic";
+my $FEXTENSION = "jpg";
+
+my $into_current_dir = 1;
+
+my $DEBUG=0;
+
+my $dir = $ARGV[0];
+if( !defined($dir) || !-d $dir ) {
+ print "hasznalat: $0 <start directory>\n\n";
+ exit;
+}
+
+
+my %files;
+&walk_files( $dir, '', \%files );
+
+for my $key (sort keys %files) {
+
+ print "($key) ", $files{$key}[0], '->', $files{$key}[1], "<<\n" if $DEBUG;
+ print "mv \"$files{$key}[0]\" \"$files{$key}[1]\"\n";
+
+}
+
+
+sub walk_files {
+ my ($base, $sdir, $rfiles) = @_;
+ print "Walking dir $base; $sdir...\n";
+
+ if( !-r "$base/$sdir" ) {
+ print "Nem olvashato $base/$sdir!\n";
+ return undef;
+ }
+
+ opendir( D, "$base/$sdir" );
+ my @entries = grep { !/^\.\.?$/ } readdir( D );
+ closedir( D );
+ foreach my $entry (@entries) {
+ if( -f "$base/$sdir/$entry" && $entry =~ /$filepattern/ ) {
+ # process file
+ my $newname = &get_newname( "$base/$sdir", $entry, $1 );
+
+ my $cnt = 1;
+ my $oname = $newname;
+ $newname .= ".$FEXTENSION";
+ while( defined( $rfiles->{$newname} ) ) {
+ print "CLASH $cnt\n" if $DEBUG;
+ $newname = "$oname-$cnt.$FEXTENSION";
+ $cnt++;
+ }
+
+ $rfiles->{$newname} = ["$base/$sdir/$entry", $newname];
+
+ print "Got file $base; $sdir; $entry.\n" if $DEBUG;
+
+ } elsif( -d "$base/$sdir/$entry" ) {
+ # walk subdir
+ &walk_files( $base, "$sdir/$entry", $rfiles );
+ }
+ }
+}
+
+
+
+sub get_newname {
+ my ($base, $entry, $basename) = @_;
+ my $time = &get_exif_time( "$base/$entry" );
+
+ my $newname;
+ if( $into_current_dir ) {
+ $newname = "./$FNAME-$time";
+ } else {
+ $newname = "$base/$FNAME-$time";
+ }
+
+ return $newname;
+}
+
+
+sub get_exif_time {
+ my $file = shift;
+
+ if( -f $file ) {
+ my $res = qx( $exifprog "$file" 2> /dev/null );
+ if( $res =~ m/Image Created: (\S+ \S+)/ ) {
+ #print "res=$_>>$1<<\n";
+ # s m h md m y
+ my @d = split /[: ]/, $1;
+ #print "mon:", join(",", @d) , "<<\n";
+ $d[1] -= 1;
+ $d[0] -= 1900;
+ return strftime("%Y.%m.%d-%H.%M.%S", @d[5,4,3,2,1,0] );
+ }
+ }
+ return "none";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/exif_settime.pl Wed May 07 16:25:00 2014 +0200
@@ -0,0 +1,87 @@
+#!/usr/bin/perl -w
+#
+# set date from exif info
+# $Id: exif_settime.pl,v 1ab5ee663fb1 2011/05/24 06:19:06 grin $
+#
+# (c)2003, Peter Gervai
+#
+
+
+use POSIX qw( strftime );
+
+my $exifprog="exiftags";
+my $filepattern = qr/^(.+)\.jpg/i;
+my $FNAME = "pic";
+my $FEXTENSION = "jpg";
+
+my $into_current_dir = 1;
+
+my $DEBUG=0;
+
+my $dir = $ARGV[0];
+if( !defined($dir) || !-d $dir ) {
+ print "hasznalat: $0 <start directory>\n\n";
+ exit;
+}
+
+
+my %files;
+&walk_files( $dir, '', \%files );
+
+for my $key (sort keys %files) {
+
+ print "($key) ", $files{$key}[0], '->', $files{$key}[1], "<<\n" if $DEBUG;
+ print "mv \"$files{$key}[0]\" \"$files{$key}[1]\"\n";
+
+}
+
+
+sub walk_files {
+ my ($base, $sdir, $rfiles) = @_;
+ print "#!/bin/sh\n#Walking dir $base; $sdir...\n";
+
+ if( !-r "$base/$sdir" ) {
+ print "#Nem olvashato $base/$sdir!\n";
+ return undef;
+ }
+
+ opendir( D, "$base/$sdir" );
+ my @entries = grep { !/^\.\.?$/ } readdir( D );
+ closedir( D );
+ foreach my $entry (@entries) {
+ if( -f "$base/$sdir/$entry" && $entry =~ /$filepattern/ ) {
+ # process file
+ my $time = &get_newtime( "$base/$sdir", $entry, $1 );
+
+ print "touch -d '$time' $base/$sdir/$entry\n";
+ }
+ }
+}
+
+
+
+sub get_newtime {
+ my ($base, $entry, $basename) = @_;
+ my $time = &get_exif_time( "$base/$entry" );
+
+ return $time;
+}
+
+
+sub get_exif_time {
+ my $file = shift;
+
+ if( -f $file ) {
+ my $res = qx( $exifprog "$file" 2> /dev/null );
+ if( $res =~ m/Image Created: (\S+ \S+)/ ) {
+ #print "res=$_>>$1<<\n";
+ # s m h md m y
+ my @d = split /[: ]/, $1;
+ #print "mon:", join(",", @d) , "<<\n";
+ $d[1] -= 1;
+ $d[0] -= 1900;
+ return strftime("%Y-%m-%d %H:%M:%S", @d[5,4,3,2,1,0] );
+ }
+ }
+ return "today";
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pdf_anonymiser.sh Wed May 07 16:25:00 2014 +0200
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# (cc) Peter Gervai, 2011
+# cc-by-sa-3.0
+#
+# remove private info from PDFs
+#
+
+if [ "$1" == "" ]; then
+ echo " "
+ echo "pdf metadata cleaner v1.00 by Peter 'grin' Gervai, 2011"
+ echo " "
+ echo "Usage: $0 filename.pdf"
+ echo " "
+ exit 0
+fi
+
+T=`mktemp /tmp/pdfanon.XXXXXXXX`
+
+# clean and dump InfoKeys
+pdftk "$1" dump_data | awk '/InfoValue/ {print $1}; !/InfoValue/ {print }' > $T
+# update empty keys in pdf
+pdftk "$1" update_info $T output "$1_new.pdf"
+mv "$1" "$1.bak"
+mv "$1_new.pdf" "$1"
+echo "$1.pdf written, old one renamed to $1.bak. Have a nice day!"
+
+rm $T
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pwgen.pl Wed May 07 16:25:00 2014 +0200
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+# $Id$
+# (c)Peter Gervai, 2002; Released under GPLv2 + CC_BY-SA-2.0
+#
+# jelszogenerator, 2002/04/08
+#
+
+if( $ARGV[0] =~ /shutup/i ) { $shutup = 1; $num=1; } else { $num = 6; }
+
+$vowel='aeiou';
+#$cons='bcdfghjklmnpqrstvwxyz';
+ $cons='bcdfghjklmnprstvxyz';
+
+$vlen=length($vowel);
+$clen=length($cons);
+
+
+$longsyl=20; # percent
+$sylnum=4 + rand(3);
+
+print "$num tok jo jelszo: " unless $shutup;
+
+
+
+for (1..$num) {
+ for my $i (1..$sylnum) {
+ print substr($cons,rand($clen),1);
+ print substr($vowel,rand($vlen),1);
+ print substr($cons,rand($clen),1) if $longsyl > rand(100);
+ #print "-";
+ }
+ print " " unless $shutup;
+}
+
+print "\n";
+print "\n" unless $shutup;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/szamolgato-szamizalo.pl Wed May 07 16:25:00 2014 +0200
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+#
+# Szamolgato v1.0, 99/10/13
+# (c)1999 peter 'grin' gervai
+#
+# kiirja egy szam erteket betukkel
+#
+
+$n=$ARGV[0] + 0;
+print "$n = ",&betukre($n),"\n";
+#print &betukre($n),"\n";
+
+
+sub betukre {
+ my $n = shift;
+
+ my @SZAM = ( 'nulla','egy','kettő','három','négy','öt','hat','hét','nyolc','kilenc' );
+ my @TIZES= ( '','tizen','huszon','harminc','negyven','ötven','hatvan','hetven','nyolcvan','kilencven' );
+
+ #my @HATVANY=( 'száz','ezer','millió','milliárd', 'billió', 'billiárd','trillió',
+ # 'trilliárd', 'kvadrillió', 'kvadrilliárd', );
+ # my @EXP = ( 2, 3, 6, 9, 12, 15, 18 );
+
+
+ my @HATVANY = qw( száz ezer );
+ my @EXP = ( 2, 3 );
+ # \/ idaig tart a szamabrazolas :)
+ my @hatvanyok1 = qw( milli billi trilli kvadrilli kvintilli szextilli
+ szeptilli oktilli nonilli decilli undecilli bidecilli tridecilli kvadecilli kvintdecilli szexdecilli );
+ for my $i ( 1..16 ) {
+ push @HATVANY, $hatvanyok1[$i-1] . 'ó';
+ push @EXP, $i*6;
+ push @HATVANY, $hatvanyok1[$i-1] . 'árd';
+ push @EXP, $i*6+3;
+ }
+
+ push @HATVANY, 'googol';
+ push @EXP, 100;
+
+ push @HATVANY, 'centillió';
+ push @EXP, 600;
+
+ # 1 googolplex = 10^googol = 10^(10^100)
+
+ my $out = "";
+
+ for( my $hatv=$#HATVANY; $hatv>=0; $hatv-- ) {
+ # 10^$hatv az alap
+ my $hatv_num = $EXP[$hatv];
+ my $alap = "1e$hatv_num" + 0;
+ if( $n>=$alap ) {
+ my $resz = int($n / $alap);
+ $out .= '-' if $out ne '';
+ $out = $out . &betukre($resz) . $HATVANY[$hatv];
+ $n -= $resz * $alap;
+ }
+ }
+
+ if( $n > 99 ) {
+ $out .= '-' if $out ne '';
+ $out .= "SOK";
+ } elsif( $n > 9 ) {
+ $out .= '-' if $out ne '';
+ if( $n==10 ) {
+ $out .= 'tíz';
+ } elsif( $n==20 ) {
+ $out .= 'húsz';
+ } else {
+ my $tizen = int( $n / 10);
+ $out .= $TIZES[$tizen] unless $tizen==0;
+ my $egyen = $n - ($tizen * 10);
+ $out .= $SZAM[$egyen] unless $egyen==0;
+ }
+ } elsif( $n > 0 ) {
+ $out .= '-' if $out ne '';
+ $out .= $SZAM[$n];
+ }
+
+ return $out;
+}
+