In this post, I’d like to do two things. First off, I want to plug a really cool site called PortableApps.com that has some really cool software in the form of … well, portable apps. What these are, are common widely used applications that have been transformed in such a way that they can run right off of your thumb drive, no install necessary, hence the term portable. They have lots of cool stuff that you can download, absolutely free, and use right off your thumb drive, or hard drive, or anywhere really. It’s nice being able to have firefox and open office (and much more) with you, no matter where you go, even with all of your own settings and customizations. That’s hard to beat! Go check it out, you won’t be disappointed I am sure. Read the rest of this entry »
Archive for the ‘PERL’ Category
27
Great stuff at PortableApps
16
PERL Round Function
Hey all your PERL junkies like me, I have a present for you. Anyone that has done any coding at all other PERL will know (and miss) the round function that most other languages have built in. For those that may not know, the round function lets you do just that, round a number to the specified digit. So, instead of having to use 3.14159265 as an answer for a particular equation, you could round it to 3.14. Nice, huh?
Well, here is a neato little round function that you can drop into your PERL scripts and call to actually round numbers instead of cutting them off with ceil or cut. Check it out:
sub round { my($number) = shift; return int($number + .5 * ($number <=> 0)); }
There you go!
**Update**
Thanks to Thierry H. for adding a little mod to the round function allowing you to specify the number of decimals to print. Here is the modified function:
sub round { my $number = shift || 0; my $dec = 10 ** (shift || 0); return int( $dec * $number + .5 * ($number <=> 0)) / $dec; }
You would call it by giving not only the number to round, but how many numbers to show on the right side of the decimal. It will look like so:
$result = round(123.4567,3);
This should return 123.457 (the 6 in the third slot gets rounded to 7). There ya go, thanks for the mod Thierry! You can check out Thierry’s site here.
13
PERL script to generate passwords
I guess this could be considered part of the password post that I put up a few minutes ago, but I wanted to post this script over in the forums that is a PERL script which generates passwords for you. Check it out, take a look and maybe you can get something beneficial from it!
28
Simple PERL file backup script
I am one of those type of people that like to make backup copies of files before I tinker with them, especially when I am modifying important files like system stuff. It’s always a good idea to make a backup copy before you edit something so you can put it back if you break it. For that reason, I wrote this simple little PERL script that I then put somewhere in my path so I can run it from anywhere. I call it simply “bu” so that it’s easy to type and use. What it does is copy the target file you specify, to a file of the same name only with a date stamp appended to it. I have found this to be a really handy tool, so I thought I would share.
Take a look at the script here.
Check it out, I hope you find it as useful as I have.
7
Solaris 10 Zone Creation Script
One of the best things about Solaris 10, from Sun Microsystems, is Zones or Containers. They allow you to create virtual OS installs on the same box, yet have them quite separate from each other. Processes are segregated, resources can be capped, the options go on and on. Here I have a PERL script (have I mentioned that I love PERL lately?), that makes the creation of zones a snap. The only thing to edit in the script is at the top, where you set your zone base directory, as in the directory that will hold the zones your create. I am a simple man, and usually just stick them all in /data/zones, with /data usually being a separate mount point and thus separate I/O path.
The script has been posted in our forums, head on over and take a look!
6
Port Ping in PERL
One tool that I haven’t seen on *nix that I see my Windows brethren using, is called portping. There is a little freeware app called portping for Windows, that is really a misnomer as it doesn’t ping anything really, but simply does a tcp connection attempt to see if the port on the destination side is answering. This is actually a really cool tool in my book, so I wrote my own in PERL since I couldn’t find something similar. Basically, you call the script, give it a destination, a protocol (TCP is used by default), and a payload to deliver if you want to send something, otherwise it simply tries to connect to the port specified. I have used it for a while now, and it has come in handy for troubleshooting network connections.
The script was posted in our forums, why don’t you take a look for yourself, and let us know what you think!







