Skip to content

Instantly share code, notes, and snippets.

janosgyerik /
Last active August 29, 2015 14:11
Hats to go for

Werewolf Hunter

  • Programmers
  • Ask Ubuntu

Tam o' Shanter

  • Unix & Linux
  • Super User

Hey guys,

A new year is a new beginning, and a good time for changes.

I’d like to have a free discussion with you, while having breakfast, to talk about last year and the coming new year:

  • What we did right and should keep doing
  • What we did wrong, what didn’t work, and should stop doing
  • New ideas we can do for this year

If I'm interpreting the definition right, the input contains single letters, all delimited by precisely one space character, and at the end of the line is a single digit (1 to 9). This is the way it seems to make the most sense. I will assume this interpretation in my answer.

First, to make the solution testable, I'd extract the main logic to a function that takes a line and returns the mth-to-last character or 0 (that's different from '0', mind you) if m is out of range.


Don't you hate it when the same file exists at multiple places. I do so, I wrote a simple utility to help clean them up.

The program takes a directory name on the command line, and traverses the filesystem tree recursively, collecting all files. Since comparing content can be expensive, to minimize the number of comparisons, I thought a merge sort logic would be effective.


Not in the 2nd monitor

Instead of posting all recent answers, how about posting only zombie killers?

What's a zombie killer? Answer on a question with no other non-deleted answers.

As a twist, to avoid encouraging FGITW style answers, add a date condition: the question must be more than X days old.

But, I don't know how much noise this will generate, and if the 2nd monitor can take it. I think it would be too much. So instead of unleashing this on the 2nd monitor, how about a new room for it called Zombie Killers.

janosgyerik / dot.gitconfig
Created May 14, 2012 13:34
My typical .gitconfig
View dot.gitconfig
name = Janos Gyerik
email =
st = status
ci = commit
br = branch
co = checkout
ls = ls-files
janosgyerik / Increase-JVM-heap-size.txt
Created May 15, 2012 15:06
Increase JVM heap size
View Increase-JVM-heap-size.txt
java -Xms64m -Xmx256m -XX:MaxPermSize=128m HelloWorld