While I am sticking with my boycott of Games Workshop, I still have plenty of armies laying around. Started painting a Blood Angels Chaplain with jump pack.
Labels
1G
(41)
4G
(6)
6th edition
(1)
angron
(1)
batrep
(2)
bible
(1)
black templar
(1)
blood angels
(2)
chaos
(16)
dark angels
(7)
dark eldar
(3)
ebay
(10)
forgeworld
(1)
gamesworkshop
(1)
grampian
(1)
heyoh painting
(18)
horus heresy
(1)
linux
(3)
orks
(10)
oss
(1)
painting
(36)
pass-a-grille
(1)
phil wickham
(1)
primarch
(1)
Projects
(35)
rambling
(36)
review
(1)
rules
(3)
sailing
(4)
space wolves
(29)
tale of one gamer
(39)
tyranids
(15)
votd
(1)
warhammer 40k
(12)
wip
(8)
Thursday, May 17, 2012
Saturday, January 7, 2012
Sunday, December 11, 2011
Tuesday, November 29, 2011
Review: YaCy Search Engine
So here is my review of YaCy, the Open Source Search Engine. Created solely that .. "no one company should control search."
Review:
Review:
Went to the site, typed in a search, results sucked, back to google.
This is like Linux on the desktop, you'll struggle to get what you really want... when there's an alternative available that gives you what you want the first time without the struggle.
They appear to be in the "Slackware" on floppies stage, call me when they're in the "Mint" stage.
Monday, November 14, 2011
Image Resize, Thumbnail Generation
Use Perl to resize images to thumbnail size. Helpful when you are supporting websites with a TON of images.
Requires Image::Magick
#!/usr/bin/perl
#Name: thumbgen.pl
#Desc: Generate thumbnail sized images from full product images.
#Author: Rob Owens
##Change##
#initial:rowens/100411
#
#Notes:
#Development Env:
#ImageRoot:/var/www/html/images
#Full:/var/www/html/images/full
#Thumb:/var/www/html/images/thumb
#
#estore.savtira.net width=70
#
# PerlMagick Method(s)
#my($image, $x);
#
#$image = Image::Magick->new;
#$x = $image->Read('Blood_for_Blood_God_by_NachoMon.jpg');
#warn "$x" if "$x";
#
#$x = $image->Resize(geometry=>'70x');
#warn "$x" if "$x";
#
#$x = $image->Write('Blood_thumb.jpg');
#warn "$x" if "$x";
#
#
#
#my $FullDir = "/var/www/html/images/full";
use Image::Magick;
require './lib/imagelib';
#my $FullDir = '/home/rowens/repos/imageresize/html/images/full';
#my $ThumbDir = '/home/rowens/repos/imageresize/html/images/thumb';
my $FullDir = $ARGV[0];
my $ThumbDir = $ARGV[1];
my $size = $ARGV[2];
my $x = x;
if (( $FullDir eq '' ) || ( $ThumbDir eq '' )) {
usage(basic);
exit 1;
} elsif ( ! -e $FullDir ) {
usage(source);
exit 1;
} elsif ( ! -e $ThumbDir ) {
usage(target);
exit 1;
}
if ( $size eq '' ) {
$Resize = '70x';
} else {
$Resize = $size . $x;
}
opendir(D, "$FullDir") || die "Can't opedir $FullDir: $!\n";
while ( my $file = readdir(D) ) {
# remove "." and ".." directories
next if ( $file =~ m/^\./ );
# only files
next if ( -d "$FullDir/$file" );
# all images into an array
push ( @tmpfull, "$file" );
}
closedir(D);
#print "@full";
foreach $tmpfile (@tmpfull) {
# printf "PRE: $ThumbDir/$tmpfile\n";
next if ( -e "$ThumbDir/$tmpfile");
# printf "PST: $ThumbDir/$tmpfile\n";
push(@full, "$tmpfile");
}
#
foreach $file (@full) {
resize("$FullDir/$file","$ThumbDir/$file","$Resize");
}
Requires Image::Magick
#!/usr/bin/perl
#Name: thumbgen.pl
#Desc: Generate thumbnail sized images from full product images.
#Author: Rob Owens
##Change##
#initial:rowens/100411
#
#Notes:
#Development Env:
#ImageRoot:/var/www/html/images
#Full:/var/www/html/images/full
#Thumb:/var/www/html/images/thumb
#
#estore.savtira.net width=70
#
# PerlMagick Method(s)
#my($image, $x);
#
#$image = Image::Magick->new;
#$x = $image->Read('Blood_for_Blood_God_by_NachoMon.jpg');
#warn "$x" if "$x";
#
#$x = $image->Resize(geometry=>'70x');
#warn "$x" if "$x";
#
#$x = $image->Write('Blood_thumb.jpg');
#warn "$x" if "$x";
#
#
#
#my $FullDir = "/var/www/html/images/full";
use Image::Magick;
require './lib/imagelib';
#my $FullDir = '/home/rowens/repos/imageresize/html/images/full';
#my $ThumbDir = '/home/rowens/repos/imageresize/html/images/thumb';
my $FullDir = $ARGV[0];
my $ThumbDir = $ARGV[1];
my $size = $ARGV[2];
my $x = x;
if (( $FullDir eq '' ) || ( $ThumbDir eq '' )) {
usage(basic);
exit 1;
} elsif ( ! -e $FullDir ) {
usage(source);
exit 1;
} elsif ( ! -e $ThumbDir ) {
usage(target);
exit 1;
}
if ( $size eq '' ) {
$Resize = '70x';
} else {
$Resize = $size . $x;
}
opendir(D, "$FullDir") || die "Can't opedir $FullDir: $!\n";
while ( my $file = readdir(D) ) {
# remove "." and ".." directories
next if ( $file =~ m/^\./ );
# only files
next if ( -d "$FullDir/$file" );
# all images into an array
push ( @tmpfull, "$file" );
}
closedir(D);
#print "@full";
foreach $tmpfile (@tmpfull) {
# printf "PRE: $ThumbDir/$tmpfile\n";
next if ( -e "$ThumbDir/$tmpfile");
# printf "PST: $ThumbDir/$tmpfile\n";
push(@full, "$tmpfile");
}
#
foreach $file (@full) {
resize("$FullDir/$file","$ThumbDir/$file","$Resize");
}
# ./lib/imagelib
#use Image::Magick
my ($image, $x);
$image = Image::Magick->new;
sub resize {
$infile = $_[0];
$outfile = $_[1];
$resize = $_[2];
my($image);
$image = Image::Magick->new;
$image->Read($infile);
$image->Resize(geometry=>$resize);
printf "Resizing image: $infile\n";
$image->Write($outfile);
return 0;
} print;
sub usage {
$err = $_[0];
if ( $err =~ /source/ ) {
printf "Error: Source Directory doesn't exist\n";
printf "Usage: thumbgen <source_directory> <target_directory> [pix width]\n\n";
} elsif ( $err =~ /target/ ) {
printf "Error: Target Directory doesn't exist\n";
printf "Usage: thumbgen <source_directory> <target_directory> [pix width]\n\n";
} elsif ( $err =~ /basic/ ) {
print<<EOF;
Thumb Generator: Used to generate thumbnails. Shrinking width size while
maintaining scale.
Usage: thumbgen <source_directory> <target_directory> [pix width]
Example(s):
Resize original images to thumbnail size, using default 70px wide:
thumbgen /var/www/html/images/full /var/www/html/images/thumb
Resize original images to thumbnail size, specifying 100px width:
thumbgen /var/www/html/images/full /var/www/html/images/thumb 100
NOTE! Program maintains the filename, hence output directory.
EOF
}
return 1;
} print;
Wednesday, October 19, 2011
Linux Remote Password Changes
1. For remote password changes, you'll need sudo rights on the remote.
2. Ensure sudo is configured for remote root commands.
a. Edit /etc/sudoers with visudo
b. comment out the following:
#Defaults requiretty
#Defaults !visiblepw
3. Generate a new password for the user using this simple perl thingie:
Example:
[doomicon@songohan tools]$ ./genpass.pl password
$1$m/Ba1kqd$LXQxR..lqUwgWE5kSPESF0
#!/usr/bin/perl
#
# usage: genpass.pl '<password>'
# Generate MD5 encrypt string for remote useradd/usermod
# rowens
#"THE BEER-WARE LICENSE" (Revision 42):
# <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
use Crypt::PasswdMD5;
my @salt = ( '.', '/', 0 .. 9, 'A' .. 'Z', 'a' .. 'z' );
$newpass="$ARGV[0]";
sub gensalt {
my $count = shift;
my $salt;
for (1..$count) {
$salt .= (@salt)[rand @salt];
}
return $salt;
}
$encryptpass = unix_md5_crypt( $newpass, gensalt(8) );
printf "$encryptpass\n";
4. Using the password just generated, we'll use the nifty '-p' option for usermod.
ssh remote_host sudo /usr/sbin/usermod -p '$1$m/Ba1kqd$LXQxR..lqUwgWE5kSPESF0' remoteuser
If you have to change this user on multiple hosts, just loop it.
for host in `grep -v ^127 /etc/hosts | awk '{ print $1 }'`
do
ssh $host sudo /usr/sbin/usermod -p '$1$m/Ba1kqd$LXQxR..lqUwgWE5kSPESF0' user
done
Fin
2. Ensure sudo is configured for remote root commands.
a. Edit /etc/sudoers with visudo
b. comment out the following:
#Defaults requiretty
#Defaults !visiblepw
3. Generate a new password for the user using this simple perl thingie:
Example:
[doomicon@songohan tools]$ ./genpass.pl password
$1$m/Ba1kqd$LXQxR..lqUwgWE5kSPESF0
#!/usr/bin/perl
#
# usage: genpass.pl '<password>'
# Generate MD5 encrypt string for remote useradd/usermod
# rowens
#"THE BEER-WARE LICENSE" (Revision 42):
# <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
use Crypt::PasswdMD5;
my @salt = ( '.', '/', 0 .. 9, 'A' .. 'Z', 'a' .. 'z' );
$newpass="$ARGV[0]";
sub gensalt {
my $count = shift;
my $salt;
for (1..$count) {
$salt .= (@salt)[rand @salt];
}
return $salt;
}
$encryptpass = unix_md5_crypt( $newpass, gensalt(8) );
printf "$encryptpass\n";
4. Using the password just generated, we'll use the nifty '-p' option for usermod.
ssh remote_host sudo /usr/sbin/usermod -p '$1$m/Ba1kqd$LXQxR..lqUwgWE5kSPESF0' remoteuser
If you have to change this user on multiple hosts, just loop it.
for host in `grep -v ^127 /etc/hosts | awk '{ print $1 }'`
do
ssh $host sudo /usr/sbin/usermod -p '$1$m/Ba1kqd$LXQxR..lqUwgWE5kSPESF0' user
done
Fin
Subscribe to:
Posts (Atom)




