Skip to content

Commit

Permalink
Obsoletes darius-tools, filenames cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Klink committed Apr 21, 2012
1 parent fc05419 commit 6965f5f
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 95 deletions.
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Stuff completely useless, or almost.

See http://yeupou.wordpress.com/

(In general, files prefixed stalag13- are specific to stalag13.ici local
network and probably cannot be used anywhere else without being at least
edited. The others should be portable as such)
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Standards-Version: 3.5.9.0
Package: stalag13-utils
Architecture: all
Depends: perl-base (>=5.6.0), perl-modules, coreutils (>=4.5.0) | fileutils (>=4.1), bash (>=2.04), findutils (>=4.1), apt-utils, gzip (>=1), libnet-dns-perl, libfile-find-rule-perl, lltag, libapt-pkg-perl, libterm-readkey-perl, libfile-homedir-perl, libdate-calc-perl, libcalendar-simple-perl, debfoster, localepurge, etckeeper, ntp
Conflicts: ntpdate
Conflicts: ntpdate, darius-admin, darius-misc, darius-sound, darius-text
Description: Stuff useful on stalag13 computers.
.
Homepage: https://gate.stalag13.ici
Expand Down
4 changes: 3 additions & 1 deletion debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ my @outdated_2011 = ("/etc/init.d/torrent",

my @outdated_2012 = ("/etc/init.d/fcgi",
"/etc/cron.daily/stalag13-ntpdate",
"/etc/cron.daily/torrent");
"/etc/cron.daily/torrent",
"/etc/profile.d/stalag13-ls.sh",
"/etc/profile.d/stalag13-tar.sh");


my @outdated = (@outdated_nov2003, @outdated_dec2003, @outdated_2004, @outdated_dec2004, @outdated_2005, @outdated_2006, @outdated_2007, @outdated_2010, @outdated_2011, @outdated_2012);
Expand Down
11 changes: 0 additions & 11 deletions etc/profile.d/stalag13-ls.sh

This file was deleted.

14 changes: 14 additions & 0 deletions etc/profile.d/stalag13-shortcuts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# tar.[bz2|gz] decompression in 4 chars.
alias targ='tar zxvf'
alias tarb='tar jxvf'

# ls
alias ls='ls --color'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'

# cleanup
function mrclean { find $1 \( -name "#*#" -or -name ".#*" -or -name "*~" -or -name ".*~" \) -exec rm -rfv {} \; }

# EOF
3 changes: 0 additions & 3 deletions etc/profile.d/stalag13-tar.sh

This file was deleted.

20 changes: 20 additions & 0 deletions etc/profile.d/stalag13-torrent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Wild assumption
TORRENT_BASEDIR=/mnt/lan/gate.stalag13.ici

# Run
function tcdcheck {
if [ ! -d "$TORRENT_BASEDIR" ]; then
echo "TORRENT_BASEDIR ($TORRENT_BASEDIR) does not exists."
return 1
fi
return 0
}

alias tcd='tcdcheck && cd $TORRENT_BASEDIR/watch'
alias tcdd='tcdcheck && cd $TORRENT_BASEDIR/download'
alias tl='tcd && tail -n 100 log'
alias ts='tcd && cat status'
alias t='tcd && ls *.trs'
alias t+='tcd && ls *.trs+'

# EOF
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/perl
# Copyright 2010 (c) Mathieu Roy <yeupou--gnu.org>
#
# Copyright 2010-2012 (c) Mathieu Roy <yeupou--gnu.org>
# http://yeupou.wordpress.com
#
# Thi program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -18,6 +20,9 @@
use strict;
use POSIX qw/setsid/;

my @redshift_opts=("-l", "48.799:2.505",
"-t", "6500:3700");

# search for any redshift process in /proc
my @tokill;
opendir(PROC, "/proc");
Expand Down Expand Up @@ -62,8 +67,6 @@
open(STDOUT, ">/dev/null");
open(STDERR, ">&STDOUT");
# make it redshift
exec("redshift",
"-l 48.799:2.505",
"-t 6500:9300");
exec("redshift", @redshift_opts);

# EOF
4 changes: 2 additions & 2 deletions usr/local/bin/stalag13-cleanup-music-directory-02-rename.pl
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@
closedir(ALBUMDIR);

# more cleanups
print "/usr/bin/urlize -D $destdir\n";
system("/usr/bin/urlize", "-D", $destdir) unless $debug;
print "/usr/local/bin/urlize -D $destdir\n";
system("/usr/local/bin/urlize", "-D", $destdir) unless $debug;
print "/bin/chown -R $user:$user $maindir/$style/band/\n";
system("/bin/chown", "-R", "$user:$user", "$maindir/$style/$band/") unless $debug;
print "/bin/chmod -R a+r $maindir/$style/$band/\n";
Expand Down
73 changes: 0 additions & 73 deletions usr/local/bin/stalag13-dir2x264.sh

This file was deleted.

File renamed without changes.
131 changes: 131 additions & 0 deletions usr/local/bin/urlize.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/usr/bin/perl
#
# (c) 2001-2012 Mathieu Roy <yeupou@gnu.org>
# http://yeupou.wordpress.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA

########################################
# Configuration preset

# Requirements
use strict;
use Getopt::Long;

# Usual for Darius Tools perl scripts
my $DARIUS_AUTHOR="2002-2012 Mathieu Roy";
my $DARIUS_MAIL="yeupou@gnu.org";
my $DARIUS_VER="Irrelevant";

# Specific
my $getopt;
my $help;
my $version;
my $dir;
my $expression;
my $verbose;
my $success;

########################################
# Functions definition

########################################
# Here we go

# Get options
eval {
$getopt = GetOptions("help" => \$help,
"version" => \$version,
"dir=s" => \$dir,
"expression=s" => \$expression,
"verbose" => \$verbose);
};

# Def return
if($help) {
print STDERR <<EOF;
Usage: $0 [OPTION]
Rename files in a directory to a simplified name,
(mainly for Universal Ressources Locators, URL.
-h, --help display this help and exit
--version output version information and exit
-d, --dir D rename files in dir D (default)
-e, --expression E urlize expression E
--verbose tells you what is done
EXAMPLE: $0 . # would urlize each file in the current dir
$0 -d . # same command
Report bugs or suggestions to <$DARIUS_MAIL>
EOF
exit(1);
}

if($version) {
print STDERR <<EOF;
$0 $DARIUS_VER
Copyright (c) $DARIUS_AUTHOR <$DARIUS_MAIL>
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
EOF
exit(1);
}

sub Urlize {
my $ret = $_[0];
$ret =~ tr/ /_/;
$ret =~ tr/à-é/a-e/;
$ret =~ tr/+/_/;
$ret =~ tr/=/_/;
$ret =~ tr/ù/u/;
$ret =~ s/\&//g;
$ret =~ s/\!//g;
$ret =~ s/\'//g;
$ret =~ s/\"//g;
$ret =~ s/\%//g;
return $ret;
}


if ($expression) {
print Urlize($expression)."\n";
} elsif ($dir) {
die "$dir does not exit\n" unless -e $dir;
opendir(DIR, $dir);
while (defined(my $file = readdir(DIR))) {
next if $file =~ /^\.$/;
next if $file =~ /^\.\.$/;
my $file_clean = Urlize($file);
unless ($file_clean eq $file) {
print "$file -> $file_clean\n" if $verbose;
$success = rename($dir."/".$file,$dir."/".$file_clean);
print "Failed to rename $file\n" unless $success;
} else {
print "$file = $file_clean\n" if $verbose;
}
}
closedir(DIR);
} else {
die "No expression specified, no directory specified\n";
}

# End
########################################

0 comments on commit 6965f5f

Please sign in to comment.