The Corrib was drained this weekend

posted in ireland with 0 comments

For about twenty four hours, between Saturday night and earlier this evening, all of the gates at the fisheries weir were shut and thus the river was drained. Over a quarter of a century in Galway, on and off, and I’ve never chanced to see this. It was extraordinary to see the river almost completely drained, and if I had been brave there were spots where I could’ve crossed sides without getting a foot wet.

Drained River Corrib
Drained River Corrib
Drained River Corrib

by Mark -

Useful World of Warcraft macros

posted in world of warcraft with 0 comments

I recently returned to a healing alt character in World of Warcraft, and I’ve come up with some useful and multifunctional macros to share. I have mild RSI in my right arm that was exacerbated by click-targeting, so to prevent problems I moved the bulk of my abilities to @mouseover macros, with fallback for self-targeting.

BindPad is used to manage and directly keybind macros. I copy Arthas/Masserah’s WTF folder to a new character, and it has sometimes caused problems and deleted macros. BindPad stores macros separately to the WTF folder, and allows me to quickly import and set up profiles regardless of server or character.

Mount macro: bound to x

/petfollow
/dismount [mounted]
/cast [mod:shift] Ghost Wolf
/cast [mod:alt,@mouseover,help,exists,nodead] Water Walking
/cast [mod:alt] Water Walking
/cast [nomod,swimming] Abyssal Seahorse
/castrandom [nomod,flyable] Ashes of Al'ar, Onyxian Drake, Thundering Onyx Cloud Serpent, Armored Red Dragonhawk
/castrandom [nomod] Raven Lord, Ultramarine Qiraji Battle Tank, Vicious War Wolf, Swift Zulian Panther, Ashhide Mushan Beast

This is my mount-movement macro. I recall my pet, with shift jump into Ghost Wolf, with alt cast Water Walking, and with nomod I cast an area-appropriate mount: Swimming? Seahorse. Flying? Ashes et al. Battleground? Ground mount. If you use a Death Knight you substitute Path of Frost for Water Walking, or Dispersion or Angelic Feather for Ghost Wolf as a Priest.

Target macro: Bound to tab

/cleartarget
/targetenemyplayer

As an Enhancement Shaman, in a brawl I only care about those other players I can reach. Tab targeting in World of Warcraft works as follows:

  1. Target the closest player/monster directly in front of the player.
  2. Pick the next target from players/monsters in a widening cone in front of the player. The cone is roughly 90° wide-45° to the left and 45° to the right.

This macro skips step 2, so tab target will only ever pick the closest player to my character.

Friendly and hostile purge: shift + d

/cast [harm,nodead,exists] Purge
/cast [@mouseover,help,nodead,exists] Cleanse Spirit
/cast Cleanse Spirit

Shaman have both offensive and defensive purge abilities. This firstly cleanses the hostile target, then a friendly @mouseover target, then finally a friendly target.

Friendly healing: bound to f

/cast [@mouseover,help,exists,nodead] Healing Surge
/cast Healing Surge

Just as with purging, when I get five Maelstrom Weapon stacks I need to throw out heals to my teammates and I. This heals my mouseover target, and falls back to healing myself.

Although these are only a few macros, hopefully they give you an idea of how to macro and combine spells and abilities in a manner that is RSI-friendly!

by Mark -

Spires in Flight

posted in ireland with 3 comments

When I first met Eadaoin at the Dublin picnic, I speculated about what would happen if the Spire of Dublin were to be dropped from space. Imagine the carnage! Imagine the fire! Without further ado:

The volume of a cone is one-third of the area of the base multiplied by the height:

0.3 * π * r2 * h

The Spire is 121.2 metres in height and 3 metres in diametre at the base:

0.3 * 3.141 * 1.5 * 1.5 * 121.2 ≈ 257 m3

The spire is mostly hollow inside:

It is constructed from eight hollow tubes of stainless steel and features a tuned mass damper[...]

The Spire’s declared mass is 126 metric tonnes. The kinetic energy delivered by an impact is:

0.5 * m * v2

Energy is measured in Joules released.

That’s simple. The more mass or velocity, the more kinetic energy is released on impact. There’s more of increase in kinetic energy from an increase in velocity than an increase in mass. I said “dropped from space”, but dropped from space can mean a great many things.

I have read the fantastic Space Weapons Earth Wars by the RAND Corporation more than once, and I am aware of considerations that will affect the impact:

  • Angle.
  • The Earth’s gravity.
  • The Spire’s initial orbit inclination, altitude, and velocity.
  • Ablation as the Spire travels through the atmosphere.

For sake of this post ending before my beer does, the Spire is dropped perfectly straight through a vacuum-that is to say it travels directly perpendicular to the ground through a perfect vacuum.

The ISS
The International Space Station has an average orbital velocity of 7.66 km/s.

0.5 * 126 * 7660 * 7660 ≈ 3696562800 J

Round it to 3.696 x 1010 Joules. A quick look at this chart finds that it is a little under four-fifths the energy of America’s air-dropped GBU-43/B Massive Ordnance Air Blast bomb. Here is an explosion for reference.

If the Spire impacted at 8910 m/s then it would release an amount comparable to a MOAB blast.

0.5 * 126 * 8910 * 8910 ≈ 5001450300 J

I do not have a single source to site, but several websites anecdotally relate that the blast radius of the MOAB is ~150 metres. Secondary effects like broken windows and launched shrapnel would project far beyond this. To reiterate: Everything within 150 metres of the bomb would be obliterated. There would still be lethal effects out to as far as 1.5 kilometres.

MOAB Dublin blast radius

I measured distances of 150 m and 1500 m in Google Maps, and filled in the circles in the Gimp. Everyone in the red circle would die, everyone in the yellow circle would be decreasingly affected by a MOAB explosion as you moved out from ground zero. Most of the energy of a kinetic impactor is directed straight into the ground (see pages 139-141 of Space Weapons Earth Wars).

Hilariously-speaking, everyone in red circle would die horribly.
Realistically-speaking, most of the energy goes into the ground, and only a fraction of the painted radius is actually affected. Consider the red circle the limits of effect. I’m out of beer, however, so the math ends here.

EDIT:

Either way, the damage proceeds downward and outward from the point of impact. In contrast, the damage for an ordinary explosive detonated at the same point would proceed outward in all directions.

If the projectile is long and rodlike, on the other hand, the steady-state phase dominates the effects. The crater is more cylindrical and its depth is proportional to the square root of the ratio of projectile density over target density. If the kinetic-energy weapon must penetrate shielding, e.g., a ship’s hull or a bunker, the depth to be penetrated determines the minimum projectile length, depending on the density of the shielding material. For example, a 1-m-long tungsten hypervelocity penetrator should be able to penetrate about 1.5 m of steel, almost 3 m of clay or stone, and 1 m of uranium. What penetrates through that depth (or less) of target will be a very hot mixture of target and penetrator material and any remaining penetrator length. The damage is done almost entirely in the direction of the impact, as with a shaped charge explosive, except for damage caused by secondary fires or explosions ignited by the impact.Bob Preston et al., Space Weapons Earth Wars (RAND Corporation, 2003), 141.

The direction in which damage is done after a kinetic impact depends on:

  1. The shape of the impactor.
  2. The velocity of the impactor.
  3. The hardness of the impacted surface.

All of the energy from the Spire would be directed into the ground. The big difference in impact comes from whether the Spire is travelling faster than the speed of sound in concrete. It is-a velocity of 8910 m/s versus a speed of sound of ~3600 m/s. In the comments below Paul linked NUKEMAP, an interactive tool for the armchair nuclear strategist. The problem is that unless you use a nuclear shaped charge, the energy in a nuclear explosion is released omnidirectionally. That is to say it radiates equally in all directions.

In a kinetic impactor, all of the energy is initially delivered to a point on the ground equal in area to the surface area of the weapon.

3.141 * 1.5 * 1.5 = 7.06725 m2

All 5.014 * 1010 J of energy is delivered to an area of ground about seven metres square. There would be hypersonic shock wave through the ground-expect a lot of broken legs, angles, and spines as that energy transfers itself from the ground into bystanders. There would be a supersonic aerial shockwave, albeit at a fraction of the energy of the ground impact. Windows turned to deadly aerosol, cars knocked over, and people killed by debris nearby.

You would hear the impact. You would feel it in the ground and the air. You would be knocked off your feet a few blocks away. Windows would be blown out for up to a kilometre around. That’s in a perpendicular impact. If the Spire impacted at an angle, then the energy would be transferred at a tangent to the ground, and destruction in the vicinity would be correspondingly greater.

Worst part? It’s hypersonic. The sound of the impactor’s passage is several seconds behind the impactor. If it came in at an angle in a built-up urban area, you wouldn’t see or hear it until it already hit.

Watch the skies!

EDIT 2: How many would be hurt?
I cannot find good numbers for the density of people in Dublin city centre. The population there is transient, in that while relatively few people live within, say, a kilometre of O’Connell Street, many thousands of people will be on the street on a given day. To extract from the 2011 census data:

Stat #
Area (Sq km) 318
Population (including Suburbs or Environs)(Number) 1,110,627
Population Density (persons per sq km) (Number) 3,498.2
Population within Legally Defined Boundary (Number) 527,612
Population of Suburbs or Environs (Number) 583,015
Population Change Since Previous Census (%) 6.2

I’ll arbitrarily triple the density by assuming Dublin city centre on a Saturday afternoon. There would be upwards of almost eleven thousand people in the area affected by the impact.

by Mark -

Find duplicate files in a directory

posted in code with 0 comments

When I photographed heavily/professionally, I was rigorous in how I handled my imported raw files, and master processed (PSD/XCF) files. I was much less rigorous in how I sorted and stored my processed JPG files, to the point that I’ve found several directories with anywhere between hundreds and thousand of images, some or many of them straight duplicates.

For the hell of it, and also because I haven’t touched C# since early 2013, I drew up a simple console application in C# to search for duplicate file in a given directory. I made a good start on it in Bash, but…fuck. Bash is slow and interacting with arrays in Bash leaves me wanting to murder somebody.

Order of the program:

  1. Check directory was provided. Check directory exists. Check it has more than one file.
  2. Get list of files in directory.
  3. Generate MD5 checksums for each given file.
  4. For each checksum:
    i. Check each file after this in the list to see if it has the same sum.
    ii. If a duplicate is found, check if it is on the recorded dupe list.
    iii. If it isn’t on the dupe list, add it.
  5. Run through the file list once for each dupe checksum. Print all file names with the same checksum.

I need to find more little projects like this in C#; it was fun to dust off what I knew.

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Security.Cryptography;

public class findDupes {
    static void Main(string[] args) {
        CheckBeforeProceeding(args);

        string[] files = Directory.GetFiles(args[0]);
        List<string> filesums = new List<string>();

        foreach (string file in files)
            filesums.Add(GetFileSum(file));

        List<string> dupes = SearchForDupes(filesums);
        PrintDupes(filesums, dupes, files);
    }

    static void PrintDupes(List<string> sums, List<string> dupes, string[] files) {
        // Print output.
        foreach (string dupe in dupes) {
            Console.WriteLine("{0}\n----------", dupe);

            for (int i = 0; i <= (files.Length - 1); i++)
                if (sums[i] == dupe)
                    Console.WriteLine(files[i]);

            Console.WriteLine();
        }
    }

    static List<string> SearchForDupes(List<string> sums) {
        // Search for duplicate files within the given list of sums.
        List<string> dupes = new List<string>();

        for (int i = 0; i <= (sums.Count - 2); i++)
            for (int j = (i + 1); j <= (sums.Count - 2); j++)
                if (sums[i] == sums[j])
                    if (!dupes.Contains(sums[i]))
                        dupes.Add(sums[i]);

        return dupes;
    }

    static void CheckBeforeProceeding(string[] args) {
        // Check things are good with the target dir before proceeding.
        if (args.Length == 0) {
            Console.WriteLine("Error: No directory provided");
            Environment.Exit(1);
        }

        if (!Directory.Exists(args[0])) {
            Console.WriteLine("Error: '{0}' is not a valid directory", args[0]);
            Environment.Exit(2);
        } 

        if (Directory.GetFiles(args[0]).Length == 0) {
            Console.WriteLine("Error: '{0}' does not contain any files", args[0]);
            Environment.Exit(3);
        }

        if (Directory.GetFiles(args[0]).Length == 1) {
            Console.WriteLine("Error: '{0}' only contains 1 file", args[0]);
            Environment.Exit(3);
        }
    }

    static string GetFileSum(string file) {
        // Function scalped from http://stackoverflow.com/a/10520086/1433400
        using (var sum = MD5.Create())
            using (var stream = File.OpenRead(file))
                return BitConverter.ToString(sum.ComputeHash(stream)).Replace("-","").ToLower();
    }
}

Here is some example output:

[mark][new_instagram] $ ~/dupe_find.exe .
d89b812d61bb41d037b1e6704d146d11
----------
./1.jpg
./17.jpg

4c6cc2794010fe3b018038b0e1162744
----------
./132.jpg
./312.jpg

...

Neater output from the program is left as an exercise to the reader.

by Mark -