Skip to content

Instantly share code, notes, and snippets.


Mitsunori Komatsu komamitsu

View GitHub Profile
komamitsu /
Created January 14, 2023 14:07
Execute xremap from systemd

Create /etc/systemd/system/xremap.service file

Description=xremap service

ExecStart=/usr/bin/xremap /home/komamitsu/xremap.yml
package org.komamitsu.unixdomainsockettest;
import java.nio.ByteBuffer;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
View RewriteSampleWithCalcite.kotlin
fun calcite() {
val schema = Frameworks.createRootSchema(true)
val config = Frameworks.newConfigBuilder()
komamitsu /
Created March 7, 2022 05:04
AMD sleep issue with Ubuntu 20.04
Mar 07 13:53:46 komamitsu-laptop systemd[1]: Reached target Sleep.
Mar 07 13:53:46 komamitsu-laptop systemd[1]: Starting Record successful boot for GRUB...
Mar 07 13:53:46 komamitsu-laptop systemd[1]: Starting NVIDIA system suspend actions...
Mar 07 13:53:46 komamitsu-laptop suspend[2802]: nvidia-suspend.service
Mar 07 13:53:46 komamitsu-laptop logger[2802]: <13>Mar  7 13:53:46 suspend: nvidia-suspend.service
Mar 07 13:53:46 komamitsu-laptop systemd[1]: grub-common.service: Succeeded.
Mar 07 13:53:46 komamitsu-laptop systemd[1]: Finished Record successful boot for GRUB.
Mar 07 13:53:46 komamitsu-laptop systemd[1]: nvidia-suspend.service: Succeeded.
Mar 07 13:53:46 komamitsu-laptop systemd[1]: Finished NVIDIA system suspend actions.
komamitsu /
Last active January 14, 2023 14:08
Key remapping on Linux using xkb-options


  • Make Muhenkan key a left Control key
  • Make Hiragana Katakana key an Escape key
  • Make Capslock key a Zenkaku Hankaku key


  • xmodmap: Easy, but my laptop's suspend/resume resets xmodmap configuration
  • xkb: Let's try this
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 November 29, 2021 03:15
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 June 9, 2019 14:38
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("+")) {