Mark Grealish

the life and code of a crazy cat man

Killiney Hill

in ireland

Eadaoin...fearlessEadaoin on the way upEadaoin and I

Show untracked git files

in code

This has been a real lifesaver at work.

  untracked = !git ls-files -o --exclude-standard

Bull Island

in family

Eadaoin got us out of the house this morning for a walk through Saint Anne’s park in Clontarf and across North Bull Island. Gorgeous day, showers aside!

This is my life now-Eadaoin photographing benches
Eadaoin admires the viewEadaoin in the dunes
Eadaoin in a bathing shelter

Typewriter sort returns!

in code

I am revisiting 2014’s Typewriter Permutation Simulator. Now powered by Node.js, because I want to learn more JavaScript. I have a healthy start made for a web-based performant bogosorter.

var args = process.argv.slice(2);

var permute = function() {
    var letters = this.split(''),
        count = letters.length;

    while (--count > 0) {
        var rand = Math.floor(Math.random() * count);
        [letters[count], letters[rand]] = [letters[rand], letters[count]]

    return letters.join('');

var word = {
    unsort: args[0],
    lastsort: args[0],
    sort: args[0].split('').sort().join(''),
    permutations: 0

while (word.lastsort !== word.sort) {
    word.lastsort = permute.apply(word.unsort);

    'It took %s permutations to alphabetize %s (%s)!',
mark@lucy ~ $ ./bogosort.js typewriter
It took 894352 permutations to alphabetize typewriter (eeiprrttwy)!
mark@lucy ~ $ ./bogosort.js typewriter
It took 53756 permutations to alphabetize eeiprrttwy (eeiprrttwy)!
mark@lucy ~ $ ./bogosort.js typewriter
It took 227804 permutations to alphabetize eeiprrttwy (eeiprrttwy)!

If recruiters worked in bookshops…

in ireland

Spotted this afternoon in Hodges Figgis.

JavaScript books spotted in Java section

Nonstop 5k run!

in me

In January I got sick of being fat.

5k nonstop run on treadmill!

All around me, clear to see, were middle-aged (45-60) year old people who didn’t take care of themselves. Most of my ex-wife’s family struggle with being overweight; diabetes is ubiquitous and even my ex-wife is seriously obese. My dad died of an asthma attack at 63 which was brought on by years of heavy smoking, and my mum has sleep apnea and diabetes from years of a poor lifestyle. And of myself, I ate crap, drank crap, and did nothing to exercise. I would run out of breath climbing two flights of stairs to the top of the house and, everywhere, flab.

I joined a gym in January, took the hint about my diet and got to work. I’m down 9kg on Christmas, and now that I’ve sorted my day-to-day diet after weeks of no change, I lose most of 1kg per week. I work with weights, and my cardio exercises are stages of the Couch to 5k program. Last Friday was the first time I managed to walk and run the full five kilometres without stopping.