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 / Makefile
Created June 8, 2026 06:58
aws nuke with docker image on aws cloudshell
.env:
aws configure export-credentials | jq -r '"AWS_ACCESS_KEY_ID=\(.AccessKeyId)","AWS_SECRET_ACCESS_KEY=\(.SecretAccessKey)","AWS_SESSION_TOKEN=\(.SessionToken)"' > .env
run: config.yaml .env
docker run \
-it --rm \
--mount type=bind,source=./config.yaml,target=/config.yaml \
--env-file .env \
ghcr.io/ekristen/aws-nuke:v3.65.0-23-gcc0f7e9-amd64 \
run --no-alias-check
[Adblock Plus 3.24.1]
logmi.jp##.u-print-none
@matobaa
matobaa / Makefile
Created December 28, 2023 02:56
WSL2をリフレッシュしたあとにk8s環境をセットアップするためのスクリプト
# before use file Makefile do follows:
# sudo apt udpate
# sudo apt upgrade
# sudo apt install make unzip
SHELL=/bin/bash
start:
- sudo service ssh start
- sudo service docker start
@matobaa
matobaa / Dockerfile
Created November 10, 2023 18:04
クライアント証明ありのユーザ、クライアント証明書なしのユーザを混在したい、、そんな要件どう対応するんだろうか。
# クライアント証明ありのユーザ、クライアント証明書なしのユーザを混在したい、、そんな要件どう対応するんだろうか。
FROM httpd:2.4.58-bookworm
RUN apt-get update && apt-get install -y vim
# generate Certificate Authority
RUN <<EOR1
mkdir -p demoCA/private
@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 \
@matobaa
matobaa / postgres.md
Last active June 11, 2025 06:46
AUTOINCREMENTが入れ替わる例。

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

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

graph LR;
    ST(start) --> I1
    ST(start) --> I2
    I1 --> I2
    subgraph TR1[transaction 1]
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<style>
ul {
list-style: none; /* no bullet */
}
@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 になります。

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

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 / 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),