Archive for the ‘Scripts’ Category
Mar
16
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!
Jan
19
Have you ever wanted to add an option to that ornery right click context menu so you could open whatever file you just clicked on with whatever the heck you please? I know I have, and here is a quick tip to do just that! Whether it’s your favorite text editor, or another app that you want for some reason, you can easily add an Open With option to the context menu by modifying and then importing this registry file.
Read the rest of this entry »
Dec
23
Sometimes we have to generate passwords in our code, no problem. But what about when you need to generate a password that is compatible with the htpasswd command, as in the password is the same as what would be generated by htpasswd? Well, if you are using PHP, you can use this function that I posted in the forums. Check it out …
Oct
21
Ok, here is a quick tip that has come in handy quite a few times in my days writing shell scripts, for example in bash. Let’s say, for whatever reason, you need to chop off the end of a string (like a variable). Chopping the beginning is easy, just use the cut command, but in order to chop the end you have to know how long the string is so you can tell it where to start. In this example, we are going to us the wc command to figure out how long the string is, and then subtract 1 to cut the last character. You can subtract however many you want depending on how many characters you want to cut. Check it out … Read the rest of this entry »
Aug
13
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!
Jul
28
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.