20070827

Patch to aggdraw for 64 bit machines


diff -Naur aggdraw-1.1-20051010/agg2/include/agg_array.h
aggdraw-1.1-20051010-64/agg2/include/agg_array.h
--- aggdraw-1.1-20051010/agg2/include/agg_array.h 2005-05-03
17:57:34.000000000 +0530
+++ aggdraw-1.1-20051010-64/agg2/include/agg_array.h 2007-08-22
00:19:48.000000000 +0530
@@ -520,7 +520,7 @@
int8u* ptr = m_buf_ptr;
if(alignment > 1)
{
- unsigned align = (alignment - unsigned(ptr) %
alignment) % alignment;
+ unsigned align = (alignment - (unsigned
long)(ptr) % alignment) % alignment;
size += align;
ptr += align;
if(size <= m_rest)



  • Platform :Linux, Python/C++
  • Script : Diff Patch
  • desc :

    This patch lets aggdraw compile and work fine for my requirement. But
    I haven't extensively tested it. YMMV.


20070203

voice copy



#!/usr/bin/perl

use File::Copy;

if ($ARGV[0] =~ /\/$/) {
$src = $ARGV[0];
} else {
$src = $ARGV[0] . "/";
}
if ($ARGV[1] =~ /\/$/) {
$dst = $ARGV[1];
} else {
$dst = $ARGV[1] . "/";
}

opendir(DIRHANDLE, $src) || die "Cannot opendir $src: $!";
foreach $fname (readdir(DIRHANDLE)) {
if (!($fname =~ /^\./))
{
$file = $src . $fname;
@t = localtime ( ( ( stat ( $file ) ) [9] ) );
@f = split(/[(.]/,$fname);
$s = sprintf("@f[0]_%04d%02d%02d_%02d%02d%02d.wav",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0]);
printf("%s\t%s\n",$file,$dst . $s);
copy($file, $dst . $s) || die "Cannot rename $file to $s: $!";
}
}
closedir(DIRHANDLE);







  • Platform : Unix
  • Script : perl
  • desc :

    An improved version that copies the files from source directory to destination directory after renaming.


voice rename


1 #!/usr/bin/perl
2
3
foreach(@ARGV){
4 @t = localtime ( ( ( stat ( $_ ) ) [9] ) );
5 @f = split(/[(.]/,$_);
6 $s = sprintf("@f[0]_%04d%02d%02d_%02d%02d%02d.wav",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0]);
7 printf("%s\t%s\n",$_,$s);
8 rename($_,$s) || die "Cannot rename $_ to $s: $!";
9 }



  • Platform : perl
  • Script : Rename voice files
  • desc :

    This is a script to batch rename the voice calls recorded on my phone to __