bash Command for ImageMagick Mass Conversion

Language butchery by Mr Rich on  28.7.10 @ 15:20

for file in `ls -1 [source-dir]`; do convert [source-dir]/$file -monitor -resize 784 +repage [destination-dir]/$file; done


Example out:

$> for file in `ls -1 raw/ssh-keygen`; do convert raw/ssh-keygen/$file -monitor -resize 784 +repage 784wide/ssh-keygen/$file; done
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-01-windows-command-prompt-01.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-02-windows-command-prompt-02.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-03-windows-command-prompt-03.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-04-windows-command-prompt-04.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-05-mac-admin-access-01.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-06-mac-terminal-02.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-07-mac-terminal-03.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-08-mac-terminal-04.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-09-linux-terminal-01.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-10-linux-terminal-02.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-11-linux-terminal-03.png]
Resize/Image/raw/ssh-keygen: 100% [ssh-key-gen-12-linux-terminal-04.png]


 0 comments

Gnome Cosmos Background (The Space /Astronomy Changing Pictures Background)

Language butchery by Mr Rich on  26.7.10 @ 10:25

With thanks to this guy, I finally found how to create and manage my own Gnome changing wallpaper. I like downloading pictures from Astronomy Picture of the Day, and I've wanted to add them to Gnome's space themed changing wallpaper. Gnome's wallpaper XML file isn't as slick as dumping pictures in a designated folder (although I'm sure there is something out there that does that), but it works well enough.


XML File Format



<background>
   <starttime>
     <year>2009</year>
     <month>08</month>
     <day>04</day>
     <hour>00</hour>
     <minute>00</minute>
     <second>00</second>
   </starttime>

   <static>
      <duration>time in milliseconds to display image</duration>
      <file>/absolute/path/to/image/file</file>
   </static>
   <transition>
      <duration>time in ms to transition image</duration>
      <from>/absolute/path/to/current/image/file</from>
      <to>/absolute/path/to/next/image/file</to>
   </transition>
</background>


Usage


Simply place the XML file in a location where you can edit and find it quickly. Personally, I saved the pictures (and XML file) in ~/backgrounds

 0 comments

When You Can't Even fsck, How to Reinstall grub

Language butchery by Mr Rich on  9.7.10 @ 21:50

Many thanks go out to people on this one. Credits given at the end.

So you've bricked your machine. You can't even use fsck (note: the command has one letter difference from the word said immediately prior to running it), because you just get that flashing underscore looking thing on a black screen.

Us old timers call that a cursor. When that's all you see when you boot your computer, it's not the only thing that is cursing.

Here's what you do.

RULE 1 WITH ANY LINUX DISTRO: ALWAYS HAVE A BOOT DISK.

I'm not kidding. You are up the proverbial defecation creek without a shovel and only your tongue to guide you if you don't have a boot disk. In days of old, we carried around floppies for such things. These days, you need only a live CD (preferably installed to a flash drive).

If you don't have a Live CD, you have officially learned your first Linux lesson. Go download one for your distribution right now and get it burned (or as stated before, preferably installed to a USB drive).

  1. Boot to your Live CD/USB drive.
  2. Open a terminal.
  3. List out your partitions
  4. Reconfigure grub to to to the partition with /boot.
  5. Reboot


To find your partitions, enter the following into the terminal:

df

You should see something like this:

/dev/sda2 305592212 256413288 33655720 89% /
/dev/sdb1 480719056 202796 456097060 1% /data


In the example listed above, my swap partition is /dev/sda1, and my root ( / ) partition is /dev/sda2 (yours will probably be different). I don't have /boot on a different partition, so /dev/sda2 is what I am looking for.

Here's what you want to note:
  • sda2 is the second partition on my first hard drive.
  • sdb1 is the first partition on my second hard drive.
  • grub is zero-based, so if I'll need to subtract 1 from both the number of hard drive and the partition to get it configured correctly (see below)


To reconfigure grub, at terminal enter the following:

grub
root (hd0,1)
setup (hd0)
quit


Ok... so where did the numbers come from?

First I entered root (0,1). This told grub that the root partition was on the first hard drive, second partition. Remember I said subtract 1?
  • The root partition was sda2.

  • "a" is the first letter in the English alphabet; subtract 1 and you have 0.

  • "2" indicates the second partition; subtract 1 and you have 1.

Thus, root (hd0,1)

Next I told grub to setup the root partition for booting. If you understood what I explained just previously, then this should make sense:

setup (hd0)

The final thing you need to do is reboot -- making sure you pull out your live CD/USB at the right time to you don't boot to it.

Credits


First and foremost, my older brother TK. He taught me rule #1.

Second, my co-worker and colleague, Mr. MB. He sent me a chat the last time I fubar-ed up grub, and it made me remember what to Google for. I owe you (yet another..) beer sir!

Finally, "remmelt" on the Ubuntu forums (although it worked for my OpenSuSe install too): http://ubuntuforums.org/archive/index.php/t-24113.html

Labels: , , ,


 0 comments

This page is powered by Blogger. Isn't yours?