Skip to content

Instantly share code, notes, and snippets.

View matobaa's full-sized avatar
🏠
Working from home

Akihiro MATOBA matobaa

🏠
Working from home
View GitHub Profile
@matobaa
matobaa / decolator.py
Last active July 17, 2023 15:13
decolator
try:
from functools import wraps
except:
wraps = lambda w: lambda f: f
def wrap(func):
@wraps(func)
def wrapper(*args, **kw):
return "[%s]" % func(*args, **kw)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Marked reader</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="css/style.css" />
<script src="js/marked.js"></script>
@matobaa
matobaa / AsyncAwaitInIE11WithBabel.html
Last active March 6, 2019 14:26
async/await in IE with babel
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.js"></script>
</head>
@matobaa
matobaa / default_homeend.json
Last active December 27, 2019 04:57
keymap.json with home/end/PgUp/PdDn; for https://config.qmk.fm/#/nomu30/LAYOUT
{
"keyboard": "nomu30",
"keymap": "default_homeend",
"layout": "LAYOUT",
"layers": [
[ "KC_Q", "KC_W", "KC_E", "KC_R", "KC_T", "KC_Y", "KC_U", "KC_I", "KC_O", "KC_P", "KC_BSPC",
"LCTL_T(KC_TAB)", "KC_A", "KC_S", "KC_D", "KC_F", "KC_G", "KC_H", "KC_J", "KC_K", "KC_L", "RCTL_T(KC_ENT)",
"LSFT_T(KC_DOT)", "KC_Z", "LALT_T(KC_X)", "LGUI_T(KC_C)", "LT(2,KC_V)", "LT(3,KC_B)", "LT(1,KC_N)", "KC_M", "RSFT_T(KC_SPC)"
], [
"KC_1", "KC_2", "KC_3", "KC_4", "KC_5", "KC_6", "KC_7", "KC_8", "KC_9", "KC_0", "KC_GRV",
@matobaa
matobaa / totp.js
Last active December 12, 2023 06:39
//javascript:
(secret=>{
var b32=s=>[0,8,16,24,32,40,48,56]
.map(i=>[0,1,2,3,4,5,6,7]
.map(j=>s.charCodeAt(i+j)).map(c=>c<65?c-24:c-65))
.map(a=>[(a[0]<<3)+(a[1]>>2),
(a[1]<<6)+(a[2]<<1)+(a[3]>>4),
(a[3]<<4)+(a[4]>>1),
(a[4]<<7)+(a[5]<<2)+(a[6]>>3),
(a[6]<<5)+(a[7]>>0),
if [ ! `which git` ]; then
read -p "git: command not found. install [y/N]? "
[ ! x${REPLY^} == xY ] && exit 1
[ `which yum` ] && yum install git # RHEL
[ `which apt` ] && sudo apt-get update && sudo apt-get install git # Debian
[ `which apk` ] && apk add git # Alpine
fi
git clone --config=core.autocflf=input https://github.com/redmine/redmine.git app
@matobaa
matobaa / death_march.md
Last active February 10, 2022 15:17 — forked from voluntas/death_march.md
デスマーチが起きる理由 - 3つの指標

デスマーチが起きる理由 - 3つの指標

著者: 青い鴉(ぶるくろ)さん @bluecrow2

これは結城浩さんの運用されていた YukiWiki に当時 Coffee 様 (青い鴉(ぶるくろ)さん)がかかれていた文章です。 ただ 2018 年 3 月 7 日に YukiWiki が運用停止したため消えてしまいました。その記事のバックアップです。

今は 404 ですが、もともとの記事の URL は http://www.hyuki.com/yukiwiki/wiki.cgi?%A5%C7%A5%B9%A5%DE%A1%BC%A5%C1%A4%AC%B5%AF%A4%AD%A4%EB%CD%FD%CD%B3 になります。

昔、自分がとても感銘を受けた文章なので、このまま読めなくなるのはとてももったいないと思い、バックアップとして公開しています。

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<style>
ul {
list-style: none; /* no bullet */
}
@matobaa
matobaa / postgres.md
Last active July 26, 2023 01:40
AUTOINCREMENTが入れ替わる例。

システム間で差分連携しているとき、差分抽出にシリアル値を使うと取りこぼします。

RDBのシリアル値(MySQLのAUTOINCREMENT、PostgreSQLのSERIAL)はトランザクション分離をまたいでカウントアップするけれど、トランザクションがロールバックされるとそのシリアル値は消滅するし、コミット時刻が遅くなる場合、シリアル値でのソートとコミットされた時刻ソートは異なる結果になるよ、という例です。

graph LR;
    ST(start) --> I1
    ST(start) --> I2
    I1 --> I2
    subgraph TR1[transaction 1]
@matobaa
matobaa / Dockerfile
Created September 18, 2023 18:24
mojo dockerfile for a vscode user who is not root
FROM ubuntu:latest
# see also: https://developer.modular.com/download#:~:text=Manual%20installation%20steps
# install prerequirements
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
gnupg \