Tag Archive for 'ubuntu'

Scripting Gimp (batch mode)

The Gimp has a wonderful feature that allows you to run it non-interactively (no User Interface) from the ‘command line’. This allows you to write scripts that can be used in the shell!

I have lots of film negatives that have been scanned to the computer and all were saved as .BMP files. I wrote a simple script to open each file, adjust the levels, and save as a .JPG.

; ec-levels-stretch

(define (ec pattern)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let*
(
(filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(new_filename (string-append filename “.jpg”))
(drawable (car (gimp-image-get-active-layer image)))
)
; (gimp-levels-stretch drawable)
(file-jpeg-save 1 image drawable new_filename “” 0.85 0 1 0 “” 0 1 0 1)
(gimp-image-delete image)
)
(set! filelist (cdr filelist))
)
)
)

(script-fu-register “ec”
“ec”
“Batch Auto Levels”
“Emery clark”
“Emery Clark”
“2010″
“RGB* GRAY*”

)
(script-fu-menu-register “ec”
/Filters”)

; End script

Put the script in ‘/home/your_username/.gimp-2.6/scripts’ You can run this from the command line by ‘cd /dir/with/images/’ then:

gimp -i -b ‘(ec ” *.png ” )’ -b ‘(gimp-quit 0)’

Read more about batch mode http://www.gimp.org/tutorials/Basic_Batch/. Note: I have tried a modified version of this script and have yet to get it working on the Windows XP command line, please let me know if you can do it. I had to resort to a linux machine.

Installing a LAMP (Linux, Apache, MySQL, PHP) server on Ubuntu 9.10

Ubuntu makes this really easy with version 9.10. ‘System > Administration > Synaptic Package Manager > Sort > Mark by Task’. There will be an option for ‘LAMP server’.

Your web directory will be in /var/www but it will be owned by root. You can run ’sudo chown YOUR_USERNAME /var/www/’ you can put your files here and they will be visable when you visit ‘http://127.0.0.1/’ or ‘http://localhost/’ in your web browser.

Networking on Virtual Box XP Ubuntu 9.10

There are several ways to setup networking with your ‘Guest’ OS in Virtual Box. Virtual Box defaults to NAT (Network Address Translation) which typically works fine out of the box. However, to make your virtual machine visable to your Host OS or other machines on your network, you need to enable ‘Bridged Networking’ in the ‘Settings’ for your virtual machine. In order for this to work properly you will need a router with DHCP.

First, ‘Start > Run’ type ‘cmd’. Type ‘ipconfig /all’ write down all the information you see, specificially ‘DNS/Name servers’.  Then ‘Start menu > Control Panels > Networking Connections’ and Right click on ‘Local Area Connection’ > ‘Properties’. ‘General’ > ‘Internet Protocal (TCP/IP)’ > Properties > ‘Use the following address’. give your Host OS a ’static IP’ (eg~ 192.168.1.2).

Back to Networking Connections, Right-click ‘VirtualBox Host-Only Network’, same thing, except give it an address within the range of the DHCP server on your router (eg~ 192.168.1.102). Now in VirtualBox, select ‘Settings’ and enable ‘Bridged Adapter’ under ‘Network’. Start your VM. You should be able to PING your Guest OS from your Host OS. Install OpenSSH-server on your Guest OS and you can SSH!

Guest Additions on VirtualBox Ubuntu 9.10

Guest Additions is a feature of Virtual Box that allows you to install drivers on the guest OS to help integrate better with your host (XP) OS. Go to [IMPORTANT] http://download.virtualbox.org/virtualbox/ and choose your version number, probably ‘3.1.2′ and download the .iso file.

To install the guest additions, refer to the Virtual Box User Manual (F1). You will need to ’sudo apt-get install dkms’, mount and browse to the CD, and run the installer script. This will install several kernel modules, then you will need to restart the virtual machine. This will enable features such as host-guest file/folder sharing, and host-machine mouse integration. Highly reccomended.

Install Chinese language support on Ubuntu 9.10

System > Administration > Language Support > ‘Install / Remove Languages’. This will install Chinese character support and the IBUS-Pinyin input method.

Installing Ubuntu 9.10

The Ubunutu installer supports many languages. I reccomend installing Ubunutu via Virtual Box. This will allow you to run Ubuntu in Windows XP/Visa/7. At the installer prompt, select the language you want.

A few tips when installing via VirtualBox, since you have already designated ‘Dynmaically expanding storage’ let the Ubuntu installation ‘ Guided partition’ and select the ‘entire hard disk’. It is helpful if you have an internet connection (wired ethernet) because Ubuntu will install packages during the installation. The entire installation should take less than an hour unless your internet connection is slow. If in doubt, press Alt-F4 to switch to the installation details; you can switch back using Alt-F1.

Installing Ubuntu 9.10 on Virtual Box with Windows XP

First, you need to install the Virtual Box program. Download the .EXE from VirtualBox.org and follow the on-screen instructions to install. Simple. Now, open the program and click New. This will help you create a new ‘virtual machine’. Enter a name and choose the type of the “guest” operating system: Windows, Linux, Solaris, BSD, IBM OS/2, or Other. (An easy choice for Linux is Ubuntu 9.10, which I highly recommend. See this post for downloading instructions.) Next, I choose 640MB RAM because my computer has 2.5GB installed. For Ubuntu, you will be safe with 384MB but you might want to choose 512MB instead, Next. Choose ‘Create a New Hard disk’, Next. You want ‘Dynamically expanding storage’, Next. Define a location. 8.00GB should be large enough for the hard drive, Next. Finish

You will see the name of your new Virtual Machine on the left-hand list. Select it and click ‘Settings’. CD/DVD-ROM choose ‘Mount CD/DVD Drive’ and ‘ISO Image File’. Browse to where you saved the Ubunutu.iso, OK. Click ‘Start’ from the main menu. This will bring you to the Ubuntu installer.

Using Bittorrent to Download Ubuntu 9.10

Head over to http://www.ubuntu.com/GetUbuntu/download. If you like, you canthe ‘Begin Download’ button which will download the entire file over HTTP (a single connection from the Ubunutu server to your computer). This is fine for smaller files, howerver, I will reccomend a few better options that can save a good amount of time and help conserve bandwidth. Click “Alternative download options, including Ubuntu installer for Windows”. Now, find and click the link that says “Bittorent”. If you do not have Bittorent software installed, download uTorrent.

(A bit about Bittorrent: Bittorent is a technology that allows a large number users to download files at high speed while reducing the bandwidth consumed. It does this by allowing users to connect to a ’swarm’ and share the files amongst themselves. The first ’seeder’ will upload a copy to the ‘peers’ who will receive different parts of the file. In theory, at least 100% of the file has been distributed among the peers, the original seeder can leave and the file can sucessfully be transmitted to an unlimited number of peers. To understand more, see the uTorrent User Manual.)

You will want to choose “ubuntu-9.10-alternate-i386.iso.torrent”.  The Alternate version is a text-based install that is quicker and just as easy as the “Dekstop” version. I reccomend it. Ubuntu 9.10 is the latest version, released in October (10) of 2009. Save and Open the .torrent file with uTorrent. uTorrent will prompt you for a place to save the Ubunutu.iso file. Choose a destination and go make yourself some tea.

After thee ISO has downloaded you can install it on your hard disc to run as a replacement for XP, or in addition to XP by using Vitural Box.