Groovy

Scaling Images With Groovy

I had the need to scale some large JPG images from my camera so I whipped up a quick little Groovy script to do the trick. Thought I would share.

// groovy ScaleImages.groovy DIRNAME SCALE%

import javax.imageio.ImageIO
import java.io.File
import java.awt.Image
import java.awt.Color
import java.awt.image.BufferedImage

class ScaleImages {

    static void main(String[] args){
        def directory = new File(args[0])
        if(!directory.isDirectory()){
No votes yet

Bubble Sort

I did some more comparative programming around Bubble Sort recently which I decided to post here, to both save it for myself and share with others. This time rather than posting multiple entries (one for each language) I have decided to throw them all in the same pot.

No votes yet

Cruise Control Project Operations (Groovy)

Yesterday I posted a little Ruby script for performing CruiseControl operations (see Cruise Control Project Operations); I got to thinking last night that this would also be quite easy to do in Groovy… and it was:

package cc;

class CruiseExec {
    private static cruiseUrl = 'http://builder:8000';
    private static projects = ['nightly-build','releases','site-build']

    static void main(args) {
No votes yet

Playlist Randomization

I love WinAmp; however, I have always felt that it’s playlist randomization was a little on the weak side. Not really wanting to dive into writing a C++ winamp plugin, I took the alternate approach of writing a Groovy script to randomize playlist files.

// PlaylistRandomizer.groovy
import java.io.File
import java.util.ArrayList
import java.util.Collections
import java.security.SecureRandom

def songs = new ArrayList()
new File(args[0]).eachLine {
    if(!it.startsWith('#')){
        songs << it
    }
No votes yet