Skip to content

Instantly share code, notes, and snippets.

View KEINOS's full-sized avatar

KEINOS KEINOS

View GitHub Profile
@KEINOS
KEINOS / microgpt.py
Created February 21, 2026 03:49 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@KEINOS
KEINOS / how-to-hide-info-msg-in-badger.md
Last active December 21, 2025 15:33
[Golang][BadgerDB] How to suppress/hide error messages

[Golang] How To Suppress/Hide Error/INFO Messages In Badger DB

TL; DR

Set Logger field of badger.Options object to nil

pathDirDB := GetMyPathDirDB()
optionsDB := badger.DefaultOptions(pathDirDB)
if !IsModeDebug {
@KEINOS
KEINOS / md5.gs
Last active December 8, 2025 08:58
GAS(Google Apps Script) user function to get MD5 hash or 4digit shortened hash for Multibyte(UTF-8, 2bytes character) environment.
/**
* ------------------------------------------
* MD5 function for GAS(GoogleAppsScript)
*
* You can get a MD5 hash value and even a 4digit short Hash value of a string.
* ------------------------------------------
* Usage1:
* `=MD5("YourStringToHash")`
* or
* `=MD5( A1 )`
@KEINOS
KEINOS / README.md
Last active October 16, 2025 11:35
Simple docker-compose.yml example to scale up containers

Scaling Up Docker Containers and Load Balancing

Simple example to scaling up Docker containers (spawning multiple containers) and load balancing them using Nginx and Traefik.

Scaling up

To scale myapp service up to 3 containers, use --scale.

docker compose up --scale myapp=3 --detach
@KEINOS
KEINOS / README.md
Created July 22, 2023 03:19
[INFO][JA] Spec info of PRITOM TronPad M10 (Android Tablet)

This is my memorandum to play-around with the Chinese Android tablet.


タブレット情報

  • メーカー名: PRITOM
  • ブランド名: TronPad
  • モデル名: M10
  • 型番: BTC1422020211227
@KEINOS
KEINOS / README.md
Last active April 4, 2025 17:02
References for OKdo Nano C100 Developer Kit (a NVIDIA Jetson Nano Developer Kit B01 - The Jetson Nano Computing Module Compatible Board)

OKdo Nano C100 Developer Kit 情報

TL;DR:

  • この gist は sudo apt upgrade を行ったばかりに、悪夢にうなされはじめた、私の備忘録です。
    もしこのキットの購入を考えているのであれば、オススメしません。基本的な Ubuntu/Debian の知識だけでなく、LINUX カーネルそのものや UART 接続などのシリアル接続にも精通している必要があるためです。正直なところ、Raspi ほど初心者向きではありません。NVIDIA のモジュールではあるものの、純正のNVIDIA製品ではないし、ややマニアックな仕様のため、NVIDIA のサポートは受けられません。NVIDIA のフォーラムでも、経験者でなければメーカーの OKdo に問い合わせることを勧められています。OKdo も製品が成熟する前に ORIN ベースの後継に注力したため、情報が圧倒的に不足しています。安物買いの銭失いとならないよう奮闘している方の参考になれば幸いです。 sudoアップグレードを行ったばかりに、毎晩悪夢を見るようになった。

  • This gist is a memorandum of the cause of my nightmares because of sudo apt upgrade.
    If you are thinking of purchasing this kit, I suggest you don't. As it requires not only basic Ubuntu/Debian knowledge, but also familiarity with the LINUX kernel itself and serial connections such as UART connections. To be honest, it is not as suitable for beginners as Raspi: although it is an NVIDIA module, it is not a true NVIDIA product, and due to its somewhat geeky specifications, NVIDIA support is not ava

@KEINOS
KEINOS / README.md
Last active March 20, 2025 04:53
[macOS] Terminal app crashes right-away on start even in safe-mode

Question

I have a MacBookPro with Monterey (OSX 12.6.9) installed. When I start the terminal("Terminal.app" application), the application crashes right away. It even crashes in safe-mode boot of the OS. What can I do or check to solve this problem?

Answer

If Terminal.app is crashing immediately upon launch, it can be a frustrating issue to deal with.

@KEINOS
KEINOS / setup-alpine-ja.sh
Last active March 6, 2025 06:44
[Alpine Linux] デスクトップ構築 日本語環境化スクリプト(xfce4, ibus, anthy)
#!/bin/sh
USER_NAME_LOGIN="keinos"
USER_NAME_FULL="KEINOS"
USER_SSH_KEY_URL="https://github.com/KEINOS.keys"
# ---------------------------------------------------------------
# Set repository mirror to the closest
# ---------------------------------------------------------------
# Detect and add fastest mirror and enable the community repo
@KEINOS
KEINOS / README.md
Last active November 17, 2024 06:01
docker-compose.yml files for home lab
@KEINOS
KEINOS / index.md
Last active October 20, 2024 00:58
【Golang】How to mock `os.Stdin` during the test in Go. 標準入力をモックする方法

GitHub Gist stars

「"golang" test "os.Stdin" "keinos"」でググってもヒットしなかったので、自分のググラビリティとして。

[Golang] How to mock/mimic os.Stdin during the test in Go

In the dependency injection point of view, it is a good practice to var OsStdin = os.Stdin and use OsStdin instead of os.Stdin. Then monkey patch (temporary replace) the variable during the test.

But if the external package doesn't support that OsStdin alias feature, and uses os.Stdin, we need to mock the os.Stdin some how.