Skip to content

Instantly share code, notes, and snippets.


Mitsunori Komatsu komamitsu

View GitHub Profile
View JPKeyboard.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; ^M
; ^H
import java.util.*;
class JsonParser {
private Object parsePrimitive(StringTokenizer tokenizer, String token) {
if (token.startsWith("\"")) {
if (token.endsWith("\"")) {
return token.subSequence(1, token.length() - 1);
StringBuilder builder = new StringBuilder(token);
komamitsu /
Last active Feb 7, 2021
GraalVM shared library example which receives String arguments called from C
package org.komamitsu.foobar;
import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.c.function.CEntryPoint;
import org.graalvm.nativeimage.c.type.CCharPointer;
import org.graalvm.nativeimage.c.type.CTypeConversion;
public class SharedStringMethod
@CEntryPoint(name = "add")
View Commands.txt
function wrap_jth {
grep 'daemon prio=' $1 | ruby -rcsv -ne 'puts CSV.parse($_,{:col_sep => "\s"}).first.first.gsub(/\d/, "0")' | sort | uniq -c
komamitsu /
Created Jun 9, 2019
Small S-exp like arithmetic code interpreter in Java
package org.komamitsu.test;
import java.util.StringTokenizer;
public class ArithmeticCodeEvaluator
private static int eval(StringTokenizer tokenizer)
String first = tokenizer.nextToken();
if (first.equals("+")) {
komamitsu / Command.txt
Created Nov 12, 2018
Calling Fluency from C using GraalVM:SubstrateVM
View Command.txt
$ javac -cp fluency-1.9.0-SNAPSHOT-shadow.jar org/komamitsu/fluencycaller/
$ native-image --class-path fluency-1.9.0-SNAPSHOT-shadow.jar:. --shared -H:Name=libfluency --verbose
$ cc -Wall -I. -L. -lfluency main.c
$ ./a.out
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
komamitsu / komamitsu.json
Last active Feb 27, 2019
Karabiner-Elements Config
View komamitsu.json
"title": "Komamitsu's configuration",
"rules": [
"description": "Internal US keyboard (1452/632): Post option if left_control is pressed.",
"manipulators": [
"type": "basic",
"conditions": [
import org.rocksdb.EnvOptions;
import org.rocksdb.FlushOptions;
import org.rocksdb.IngestExternalFileOptions;
import org.rocksdb.Options;
import org.rocksdb.OptionsUtil;
import org.rocksdb.RocksDB;
import org.rocksdb.SstFileWriter;
public class RocksDBTest
komamitsu / gist:baa92b5dbd270f21938e55c97f00c350
Last active Apr 27, 2018
io.digdag.core.workflow.WorkflowExecutorTest#retryOnGroupingTask at jackson-2_8_11 branch
View gist:baa92b5dbd270f21938e55c97f00c350
Config localConfig = config.getFactory().create();
for (String localKey : request.getLocalConfig().getKeys()) {
>>> localConfig.set(localKey, config.getOptional(localKey, JsonNode.class).transform(JsonNode::deepCopy).orNull());
ex = {java.lang.ClassCastException@5548} "java.lang.ClassCastException: java.lang.String cannot be cast to com.fasterxml.jackson.databind.JsonNode"
detailMessage = "java.lang.String cannot be cast to com.fasterxml.jackson.databind.JsonNode"
cause = {java.lang.ClassCastException@5548} "java.lang.ClassCastException: java.lang.String cannot be cast to com.fasterxml.jackson.databind.JsonNode"