Batch converting Works (WPS) to Word (DOC)

Posted on September 20th, 2008 by hamstar

My friends mum needed a bunch of works files to work on her PC, but I could so not be bothered searching around for a works install disc, plus the converter from the Microsoft site wasn’t working.

So I took the documents to work where I knew the converter was working but there was still like over 100 documents and I didn’t want to open and save each one.

Luckily I found this page (can’t believe I’m linking to an MS site) which had a macro to use to convert a whole bunch of WPS’s to DOC’s.

I’ll re-post it here incase that other page disappears (also I made an adjustment so it works):
Read more »

Tags: , ,

Process multiple items in command line

Posted on December 8th, 2007 by hamstar

This is great, I saw it somewhere the other day but can’t remember where. It is pretty simple too… sometimes when I do stuff on the command line with cut I try to run multiple commands on the output, but it never works cos I try to it with sed but with this method it works great.

Check it out:

for i in `ps auwx|grep hamstar|cut -f2 -d’ ‘`; do kill $i; done

That would kill all the processes that I have started under my username. Notice the red part is where it takes all the entries (puts each one into $i as it uses it, and the blue part is where it does something with the entries ($i again)). Adding kill to the start and ; to the end using sed would not work for this.

Ok that might a bit tricky for some of you, especially if you haven’t come across the miracle of piping yet, let me show you a simpler one.

for i in *; do echo $i; done

Basically another form of ls but thing of the things you can do with this. Rename from lowercase to uppercase:

for i in *; do mv $i `echo $i|tr [A-Z] [a-z]`; done

So its basically limitless to what you can do with this cool thing.

I also found another cool thing while writing this. Doing the following will covert all characters in a given file to lowercase or uppercase if you changed it:

dd file.txt conv=lcase

Tags: , ,

Open a remote machines window on your desktop

Posted on August 21st, 2007 by hamstar

So I found out a little while ago that the X server can do this thing where it outputs the window from the machine its running on, to a remote machine, also running an X server. I did this a few times and its pretty damn cool. Basically you simply open a console, set the DISPLAY variable to something like 10.0.0.2:0 and it will open on that IP and that display once you add your machine to that machines xhost list. You follow me? No?

Okay, here it is broken down. Lets say, you have two linux boxes, both running GUI’s, and you want to open gedit on one machine (machine1), but display it on the other machine (machine2):

Read more »

Tags: , ,

Open a program from one linux box on another boxes screen

Posted on April 7th, 2007 by hamstar

How cool would it be to be able run a program from your main computer, but have the window for it come up on say, your laptop while you’re sitting on your bed? Thats what I do.

My main problem is that I can’t get internet on my laptop at home. I’m on dialup and my external modem only connects by serial, which my laptop doesn’t have. Problem.

Solution. I can ssh into my main box which has the modem, connect it to the net and run firefox and it will open it on my laptop screen, using the network. This is a built in feature of X, the display manager for linux.

This HOWTO assumes the following:

  1. You already have ssh setup on the main box
  2. The main box is called serj with an IP of 10.0.0.1
  3. The other box is called malakian with an IP of 10.0.0.4

Here’s how ya do it:

  1. Open up a console window
  2. Add the other box to your X “allow” list by typing the following:
    xhost serj


  3. Find out your display number and remember it (lets say it is 1). Type:
    echo $DISPLAY


  4. SSH into your main box from the other box
    ssh serj -l <em>username</em>


  5. Once you’ve logged in, you need to edit the DISPLAY variable to be the IP and display number (1) of the box you’re on and export it:
    DISPLAY=10.0.0.4:1; export DISPLAY


  6. Once you’ve done that check that it is set properly by echo’ing the DISPLAY variable again. It should show 10.0.0.4:1
    echo $DISPLAY
  7. Now simply run a program like firefox from the command line and the window will open on your box:
    firefox

When you run a program it will open with all the settings from your main box. Unfortunately it won’t work with 3D games but there are a few things it could be useful for e.g.:

  1. Administering one of your screenless servers through an actual GUI (provided you installed with KDE/gnome/some other window manager)
  2. Opening dirty sites on your friends/workmates PC. Open a console, set your display to your workmates IP/display and run
    firefox http://nastyjapanesegirls.com

    . Of course it will be running of your profile so he won’t get done for porn if you do this at work… you will.

There is one draw back though, all sound will run on the main box.

Tags: , ,