First, a bit of Java code to get the stomach rolling. Wait, wait, wait. Are you kidding me? This is Java code?
\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0063\u006c\u0061\u0073\u0073\u0020\u0058\u004a\u004a\u0020\u007b \u0020\u0020\u0020\u0020\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0076\u006f \u0069\u0064\u0020\u006d\u0061\u0069\u006e\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u005b\u005d\u0020\u0061\u0072\u0067 \u0073\u0029\u0020\u007b \u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074\u002e\u0070 \u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0022\u5c0f\u59d0\u59d0\u6211\u7231\u4f60\u0022\u0029\u003b \u0020\u0020\u0020\u0020\u007d \u007dCopy the code
Very responsibly, yes! Look at the picture below. Pure pure positive Java code, class for XJJ Java source code, after the implementation of the print sister I love you.
Still not convinced? Copy it yourself and run it. However, IDEA can be reported error, using the command line oh.
What a subtle way to say it. Is it a crush?
There’s nothing magical about it, we’ve just translated normal source code into Unicode encoding. That’s the Java code.
private static String toUnicode(String str) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
if(str.charAt(i) ! ='\n') {
int cp = Character.codePointAt(str, i);
int charCount = Character.charCount(cp);
if (charCount > 1) {
i += charCount - 1;
if (i >= str.length()) {
throw new IllegalArgumentException("truncated unexpectedly");
}
}
sb.append(String.format("\\u%04x", cp));
} else {
sb.append("\n"); }}return sb.toString();
}
Copy the code
At this point, I suddenly had a good idea. I’m going to code all my Java projects in this way and upload them to Github. Compiled but unreadable, even less popular than Base64.
So the following lines of Python code are born (for PYTHon3 only) :
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
java = sys.argv[1]
s = sb = u""
with open(java, 'r' , encoding='utf-8') as f:
s = f.read()
for _c in s:
sb += '\\u%04x' % ord(_c)
with open(java, 'w' , encoding='utf-8') as f:
f.write(sb)
print(java)
Copy the code
Executing the following command from the command line will translate all of the Java files in the specified directory (test) as we want.
find ./test | grep \\.java$ | xargs -I '{}' python3 uni.py {}
Copy the code
Isn’t that easy?
How to restore the Java file? I just encode, not decode, the rest is up to me, this is a good opportunity to learn about Unicode encoding.
The world of coding can be too lonely and boring projects are frequent. This one, for example, is 13, and it’s close to 4k stars. Github.com/jezen/is-th…
Paste on its API and feel the deep emptiness from the world of code farmers.
var is = require('is-thirteen');
// Now with elegant syntax.
is(13).thirteen(); // trueIs (12.8). Roughly. Thirteen (); //true
is(6).within(10).of.thirteen(); // true
is(2003).yearOfBirth(); // true
// check your math skillz
is(4).plus(5).thirteen(); // false
is(12).plus(1).thirteen(); // true
is(4).minus(12).thirteen(); // false
is(14).minus(1).thirteen(); // true
is(1).times(8).thirteen(); // false
is(26).divideby(2).thirteen(); //true
Copy the code