Skip to content

Instantly share code, notes, and snippets.

View mikoim's full-sized avatar

Eshin Kunishima mikoim

View GitHub Profile
@mikoim
mikoim / mozc.spec
Created May 3, 2019 09:47
spec file for building mozc ut2 package
%global pkg mozc
%undefine _hardened_build
Name: mozc
Version: 2.23.2815.102
Release: 2%{?dist}
Summary: A Japanese Input Method Editor (IME) designed for multi-platform
License: BSD and ASL 2.0 and UCD and Public Domain and mecab-ipadic
URL: https://github.com/google/mozc
@mikoim
mikoim / fcitx4.sh
Created September 29, 2018 07:38
Install latest fcitx4 on Fedora 28 from source
#!/bin/bash
# This script does not install dependencies. You must install them before continuing.
# ref. https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/fcitx
cd $BUILD_DIR
wget https://download.fcitx-im.org/fcitx/fcitx-4.2.9.6.tar.xz
wget https://download.fcitx-im.org/fcitx/fcitx-4.2.9.6_dict.tar.xz
wget https://download.fcitx-im.org/fcitx-configtool/fcitx-configtool-0.4.10.tar.xz
@mikoim
mikoim / layout_override
Created September 29, 2018 06:37
fcitx5 + mozc
default,us
mozc,us
@mikoim
mikoim / alacritty-wrong-font-width-workaround.patch
Last active January 12, 2018 11:56
Alacritty calculates the cell width from maximum advance via freetype2. But its value is too wide with some font. So this patch makes it use the average of rasterized glyph width instead of maximum advance.
diff --git a/src/display.rs b/src/display.rs
index 14c5a66..a5a8980 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -239,7 +239,7 @@ impl Display {
// font metrics should be computed before creating the window in the first
// place so that a resize is not needed.
let metrics = glyph_cache.font_metrics();
- let cell_width = (metrics.average_advance + font.offset().x as f64) as u32;
+ let cell_width = (glyph_cache.true_average_width() + font.offset().x as f64) as u32;
@mikoim
mikoim / default.pa
Created October 18, 2017 15:24
Roland QUAD-CAPTURE UA-55 on Linux (PulseAudio)
#### Roland QUAD-CAPTURE UA-55
# Audio input is fucking unstable, it causes kernel to crash at least in my environment.
## OUTPUT1 (headphones)
load-module module-remap-sink sink_name=output1 remix=yes master=alsa_output.usb-Roland_QUAD-CAPTURE_000085D917665F98C210A52B1B8484F8-00.analog-surround-40 channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right
## OUTPUT2
load-module module-remap-sink sink_name=output2 remix=yes master=alsa_output.usb-Roland_QUAD-CAPTURE_000085D917665F98C210A52B1B8484F8-00.analog-surround-40 channels=2 master_channel_map=rear-left,rear-right channel_map=front-left,front-right
####
@mikoim
mikoim / optimize.sh
Created October 5, 2017 14:06
Optimize all png files in history of repository with "git filter-branch" command
#!/bin/sh
FILENAME="$1"
HASH=$(md5sum "${FILENAME}")
HIT=$(grep -c "${HASH}" /tmp/hash.txt)
echo "${FILENAME}"
if [ "${HIT}" -eq 0 ];then
optipng -o7 -clobber "${FILENAME}"
@mikoim
mikoim / conoha_vps_2GB.txt
Created September 8, 2017 17:25
sysbench 1.0.8
# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 3
On-line CPU(s) list: 0-2
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 3
NUMA node(s): 1
@mikoim
mikoim / my.cnf
Created September 7, 2017 11:21
sysbench oltp_read_write --mysql-dry-run=off --mysql-socket=/run/mysqld/mysqld.sock --mysql-user=root --mysql-password=foo --table_size=1000000 --tables=20 --mysql-db=foo --time=60
[mysqld]
innodb_buffer_pool_size = 700M
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 1 # may change to 2 or 0
innodb_flush_method = O_DIRECT
@mikoim
mikoim / mastodon_ssl_issuer.md
Created July 16, 2017 11:46
mastodon SSL certificate report: issuers

2017-07-16

issuer count
/C=US/O=Let's Encrypt/CN=Let's Encrypt Authority X3 1133
/C=US/O=Amazon/OU=Server CA 1B/CN=Amazon 50
/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO ECC Domain Validation Secure Server CA 2 48
/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA Domain Validation Secure Server CA 22
/C=US/O=GeoTrust Inc./CN=RapidSSL SHA256 CA 13
/C=BE/O=GlobalSign nv-sa/CN=AlphaSSL CA - SHA256 - G2 8
@mikoim
mikoim / catalan.ex
Created July 15, 2017 09:40
Why does IO.puts print text so slow?
defmodule Catalan do
def main(argv) do
List.first(argv)
|> Integer.parse
|> (&elem(&1, 0)).()
|> parents
end
def parents(n), do: _parens("", n, n)