Hi, I am Kiru 👋 an indie hacker, a problem solver and vim-lover. I build projects to make the life of others and mine easier.

This page is intended to collect all my projects and some thoughts.

Java code comments

TIL 06.12.2019

Nea trick to hide code inside comments by closing enclosing code using unicode:


public class Dafuq {
    /**
     * This does not do what you think it does.
     * <p>
     * You think code is documentation? No! Documentation is code!
      \u002a\u002f
       static {
           out.println("No");
           exit(0);
       }
      \u002f\u002a
     */
    public static void main(String[] args) {
        out.println("Yes");
    }
}

The above code prints “NO”, and taken from here.

The above does only work for child processes (stared by the same shell). The hack works for any processes:

$ tail --pid=$pid -f /dev/null

Learned from to StackOverflow answer.

Learn more: