Skip to content

Instantly share code, notes, and snippets.

View PhilipRoman's full-sized avatar

Philip Roman PhilipRoman

  • Latvia
View GitHub Profile
#!/bin/sh
# Put in gitconfig:
# [alias]
# bvd = difftool -d -x bettervimdiff
dirA="$1"
dirB="$2"
if ! [ -d "$dirA" -a -d "$dirB" ]; then
echo 'Usage: bettervimdiff DIR1 DIR2' >&2
exit 1
fi
@PhilipRoman
PhilipRoman / Main.java
Last active April 27, 2020 06:28
WebSocketServer port test
import java.net.*;
import java.io.*;
import org.java_websocket.server.*;
import org.java_websocket.*;
import org.java_websocket.handshake.*;
public class Main extends WebSocketServer {
public static final int PORT = Integer.getInteger("port", 3141);
@PhilipRoman
PhilipRoman / Main.java
Last active April 21, 2018 13:29
Java performance anomaly: the loop with 'beta' method is 2x slower than loop with 'alpha' even though the methods are identical.
import java.lang.reflect.Field;
import java.nio.ByteBuffer;
public class Main {
private static final int N = 1_000_000;
private static Field stringBytes;
private static String testString;
static {
// setup test string: