Solarum – Information For Everyone

Archive for the ‘Scripts’ Category

Apr
11

Check out this cool service – Pastebin

I just recently found this, and I know, a bunch of you probably already know about it and maybe have for a long time. But hey, I just found out about it and it is so cool I just had to tell everyone! The site is called Pastebin and it’s a cool site (the site is very well done!) and service for anytime you are working with code, log files, and/or other gobs of strangely formatted text.

We all know how tough it is to try and past the source of our scripts, or contents of config files or log files into regular forum input boxes. Heck, for that matter, let us not forget how tough it is getting that kind of stuff posted correctly in WordPress itself. This Pastebin site allows you to past your copious amounts of text there, where it has all of the magic juju to display it properly, even formatting code correctly with syntax highlighting. All you have to do, once you paste your text into the bin, is add the link to your post or article or whatever. Then anyone reading it can go check it out at Pastebin and not try and decipher the text in whatever manner it would have gotten mangled on the screen in the first place.

I think this is going to be a great headache save for lots of us as more and more communication goes online, especially in the tech crowd.  Go check out Pastebin [link]now and see for yourself.  They have a Pro option with extra goodies, but you most certainly can use the service for free too.  If you like it, tell your friends too and help ‘em out!

Jan
26

VMware Virtual Machine Startup Shortcuts

I am going to share a VMware tidbit with you, something that some of you may already know, but for those of you that don’t, it might help out a little bit. This is particularly aimed at the VMware Workstation crowd. OK, first let me setup the background here. I have a virtual machine that I use for development all the time. It’s running on my laptop, along with my dev tools. I can open VMware workstation and then select the machine I want and fire it up and then close Workstation (since it is set to keep VM’s running when Workstation closes) and all that, but this is time consuming and somewhat aggravating if I am in a hurry. The point is, I am lazy and nit picky and making all those clicks and waiting for programs to load is tedious, especially when I sometimes do it several times a day.

So, I found a nifty little command in the directory where VMware Workstation is installed called vmrun.exe. This command allows you to manipulate your VM’s on the command line. With it you can start and stop, pause, take snapshots of your VM’s, plus many, many more actions. Look at the bottom of this article for more information, I have included the output of vmrun.exe’s usage text, and there is a bunch of stuff there!

Now, back to the article here and my purpose for writing it, what I wanted was a quick and easy way to fire up or start that virtual machine so I could use it when needed, but not have to go through all of the above mentioned steps and wait times. What I came up with was a quick little batch file that when executed, uses that vmrun.exe command to start my virtual machine, easy as pie.

Read the rest of this entry »

Aug
27

Bash function for making locate find exact matches

This is one of the coolest and most useful things to add to my UNIX/Linux profile that I have come across in a long time. I use the locate command a lot (slocate naturally) as I am sure all of us command line monkeys do. How many times have you been frustrated by the billions of lines of results flying by your screen, piping through more or less, trying to find the one nugget of goodness that you really need? Especially when you actually know the correct name of it, just not where it lives? This is where this comes in handy (this is where this? man I am eloquent)! Add this function to your bash profile (for some that’s .bash_profile and for others it might be .bashrc, depending on your nix flavor) and you can stop all of that. I haven’t tried this with other shells aside from bash, but I don’t see why it wouldn’t work.

Basically, this function uses the locate command to find whatever you are looking for just like you do, only it uses a bit of scriptology to filter it down to the exact match of what you are looking for. Yep, that’s right, the exact match! This little tidbit can really help out when you are looking for something, take a look:

## BASH locate function for exact match
## Thanks Dark_Helmet : http://solarum.com/v.php?l=1149LV99
function flocate
{
  if [ $# -gt 1 ] ; then
    display_divider=1
  else
    display_divider=0
  fi
 
  current_argument=0
  total_arguments=$#
  while [ ${current_argument} -lt ${total_arguments} ] ; do
    current_file=$1
    if [ "${display_divider}" = "1" ] ; then
      echo "----------------------------------------"
      echo "Matches for ${current_file}"
      echo "----------------------------------------"
    fi
 
    filename_re="^\(.*/\)*$( echo ${current_file} | sed s%\\.%\\\\.%g )$"
    locate -r "${filename_re}"
    shift
    (( current_argument = current_argument + 1 ))
  done
}

It’s just that easy! Copy and paste this into your profile and add a cool helper addon companion function thingy :) I wish I could say I came up with this myself, but I didn’t, I found it in some forums posted by someone named Dark_Helmet (just like the attribution link in the script). I don’t know who you are Mr. Helmet, but I thank you for your sharing this with us all, and I am passing it on! Enjoy!

Jul
16

New Firefox Addon Found, Fixes Drudge Report Refresh Roil

I am a news junkie, I love to read the news from many sources and (try to) keep up with what is going on in the world.  One of the sites I frequent a lot is the Drudge Report, and anyone who has been there will know that (to me anyway) one really annoying thing about that site is the constant page refreshing.  Maybe this is done in an attempt to load more banner ads or something, but it gets on my nerves when I keep losing my place as I am reading articles.

So, in my attempt to find an easy way to stop the Drudge Report website from refreshing every second or so (OK, maybe not EVERY second), I came across a nifty little plugin for Firefox that allows you to blacklist websites and thus stop them from running scripts.  In this case that also meant that Drudge no longer refreshes while I am reading the news.  It’s a lot like the NoScript plugin that we have talked about before, except that instead of deny all and permit by exception, this one is the other way around.  Everything is white listed by default and you blacklist sites that you don’t want to run scripts.  It works great for me, and I have found it to be quite useful.  I have added it to the Must Have Firefox Extensions page in the Library, go check it out and while you are there, see what other ones we talk about.  Enjoy!

May
17

Solarum’s Open Source Project – nix32

I thought I would post some information about a project that I started a few months ago called nix32.  It’s hosted on SourceForge for the most part, with a handy website that I host myself mainly because it’s just easier to manage that way.  The basic goal of this project is to create native command line tools for Windows that operate much like the commands that we know and love from Linux and UNIX.  Things like ls, mv, cp, df and so on.  I have become so used to, comfortable with and productive with the UNIX/Linux command line environment, that when I have to leave it behind on Windows, it’s pretty tough.  Not just changing from what I am used to, but also because I think the command line of a UNIX/Linux server is much more powerful and flexible than the Windows command line, even including the power shell.

I have been working on the more popular commands, and I have a few basics out now with basic functionality.  I hope to have more and better (improved) tools in the future.  I am writing everything in PERL and then compiling each one on Windows as a standalone exe using tools from ActiveState, and so far, they run very nicely.  It’s all completely open source, you can download the PERL scripts as well as the executable files if you want to take a look or help improve them.

Now, I know you can get similar results with other projects and products out there, CYGWIN comes to mind first.  However, that’s a whole separate shell and almost a little mini-Linux setup in and of itself, especially looking at the directory structure after it’s installed.  Here with the nix32 project I wanted to have native Windows executables that you can stick in your path somewhere and call right from the Windows Command Prompt, without ever leaving the Windows environment and without having to install anything.  So far that is exactly what we have, just copy the files somewhere, make sure it’s within or added to your PATH variable, and you are good to go!

So check it out, see what you think, spread the word and maybe even help out a bit and crunch a little code too.  Do whatever you feel and keep both feet on the wheel … or, keyboard maybe.  :)

Oct
9

Awesome Source Code Library

(Click to enlarge)

OK, boys and girls, I have a really cool treat for you.  For a long time now I have been looking for the right application to use as a source code library.  I say application because I have been trying to be open minded about what to use.  I have tried Wiki’s (which actually aren’t too bad), note taking programs, and a great many other tools, including a couple that were specifically written to be source code libraries … but in the end fell quite short of my expectations.  Also, when I say source code library, I am not and have not been looking for tons of canned code to take advantage of, that’s the problem I have now, 20+ years in IT and I already have tons of code, I just need a way to store it, sort it, search it, export it, back it up, and anything else I can think of!  I’d like to note too that in addition to all of the other features I may list here, this tool does a superb job at syntax highlighting as well.

Let me digress for a moment to mention a site called Donation Coder (www.donationcoder.com), these guys are great!  Lots of free software from some really talented developers.  There are some apps there that beat their commercial competition by a country mile, hands down.  That’s one reason why I like to hang out there, in the forums for example, these guys write software because they enjoy writing software.  Therefore they create some wicked cool stuff.

How does this pertain to the issue at hand?  Well, it was in the forums there that I ran across a thread where people were talking about their own search for a source code library much like my own search.  I found one post among others recommending different things that mentioned a free tool called “Developer’s Tips & Tricks (DTT)” from Freesoftland.  I had never heard of this group before, but I liked what I had seen posted in the Donation Coder forums, plus I really liked what I saw when reading up on their DTT tool.

Read the rest of this entry »

Search

Pages

Articles