Skip to content

Instantly share code, notes, and snippets.

Avatar

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
^M::Enter
; ^H
^H::BackSpace
View JsonParser.java
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
komamitsu / SharedStringMethod.java
Last active Feb 7, 2021
GraalVM shared library example which receives String arguments called from C
View SharedStringMethod.java
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 AndroidManifext.xml
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
@komamitsu
komamitsu / throughput.md
Last active Jun 3, 2020
Throughput comparison between fluency and fluent-logger-java
View throughput.md

Throughput comparison

Instances

  • fluency/fluent-logger-java:
  • m3.large
  • fleuentd
  • m3.large

Result

@komamitsu
komamitsu / trie.ml
Last active Apr 11, 2020
Trie in OCaml
View trie.ml
module Trie : sig
type t
val empty : t
val update : string -> int -> t -> t
val find : t -> string -> int list option
val create_from_text : string -> t
end =
struct
type node = {c:char; poslist:int list; children:t}
and t = node list
@komamitsu
komamitsu / gist:c2a5c46a22d765df5aa2
Created Feb 11, 2015
Fibonacci number with "with recursive" in PostgreSQL
View gist:c2a5c46a22d765df5aa2
with recursive r(a, b) as (
select 0::int, 1::int
union all
select b, a + b from r where b < 1000
)
select a from r;
a
-----
0
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
komamitsu / ArithmeticCodeEvaluator.java
Created Jun 9, 2019
Small S-exp like arithmetic code interpreter in Java
View ArithmeticCodeEvaluator.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
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": [
{