Skip to content

Instantly share code, notes, and snippets.

View komamitsu's full-sized avatar

Mitsunori Komatsu komamitsu

View GitHub Profile
@komamitsu
komamitsu / log.md
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
komamitsu / gist:c2a5c46a22d765df5aa2
Created February 11, 2015 08:01
Fibonacci number with "with recursive" in PostgreSQL
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
#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
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 / throughput.md
Last active June 3, 2020 12:58
Throughput comparison between fluency and fluent-logger-java

Throughput comparison

Instances

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

Result

@komamitsu
komamitsu / trie.ml
Last active April 11, 2020 19:58
Trie in OCaml
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
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 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("+")) {
@komamitsu
komamitsu / komamitsu.json
Last active February 27, 2019 01:48
Karabiner-Elements Config
{
"title": "Komamitsu's configuration",
"rules": [
{
"description": "Internal US keyboard (1452/632): Post option if left_control is pressed.",
"manipulators": [
{
"type": "basic",
"conditions": [
{
@komamitsu
komamitsu / Command.txt
Created November 12, 2018 14:42
Calling Fluency from C using GraalVM:SubstrateVM
$ javac -cp fluency-1.9.0-SNAPSHOT-shadow.jar org/komamitsu/fluencycaller/FluencyCaller.java
$ 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