Skip to content

Instantly share code, notes, and snippets.

View oshinko's full-sized avatar

Shintaro Maeda oshinko

View GitHub Profile
@oshinko
oshinko / pwned-password-checker.html
Created October 31, 2026 03:48
パスワードが既知の漏洩データに含まれているか確認できるツールです。パスワード自体は送信せず、SHA-1 ハッシュの先頭5文字だけを使って照会します。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="パスワードが既知の漏洩データに含まれているか確認できるツールです。パスワード自体は送信せず、SHA-1 ハッシュの先頭5文字だけを使って照会します。">
<title>Pwned Passwords Checker</title>
<style>
:root { color-scheme: light dark; font-family: system-ui, -apple-system, sans-serif; }
body { max-width: 560px; margin: 8vh auto; padding: 0 20px; line-height: 1.6; }
@oshinko
oshinko / switch-codex-version.ps1
Created October 10, 2026 02:57
Switch OpenAI Codex CLI and managed app-server daemon to a specified version on Windows
# Usage: powershell -ExecutionPolicy Bypass -File switch-codex-version.ps1 -Version 0.160.1
# Ref: https://github.com/openai/codex/issues/50321#issuecomment-6052089340
param(
[string]$Version
)
$ErrorActionPreference = "Stop"
if ($Version -notmatch '^\d+\.\d+\.\d+$') {
@oshinko
oshinko / glassworm-codec.js
Last active March 21, 2026 04:10
GlassWorm Codec
// 実行環境に応じて UTF-8 バイト列へ変換
const encodeUtf8 = str =>
typeof Buffer !== 'undefined' ?
Buffer.from(str, 'utf-8') :
new TextEncoder().encode(str);
// 実行環境に応じて UTF-8 バイト列を文字列へ戻す
const decodeUtf8 = bytes =>
typeof Buffer !== 'undefined' ?
Buffer.from(bytes).toString('utf-8') :
@oshinko
oshinko / glassworm-demo.js
Last active March 21, 2026 03:57
GlassWorm Demo
// https://www.aikido.dev/blog/glassworm-returns-unicode-attack-github-npm-vscode
const s = v => [...v].map(w => (
w = w.codePointAt(0),
0xFE00 <= w && w <= 0xFE0F ? w - 0xFE00 :
0xE0100 <= w && w <= 0xE01EF ? w - 0xE0100 + 16 : null
)).filter(n => n !== null);
const d = v => typeof Buffer !== 'undefined' ?
Buffer.from(s(v)).toString('utf-8') :
new TextDecoder().decode(Uint8Array.from(s(v)));
@oshinko
oshinko / sort-tasks.gs
Last active March 15, 2024 08:11
For the ToDo list of Google Spreadsheet
function sort() {
const TARGET_SHEETS = ['全て']
const sheet = SpreadsheetApp.getActiveSheet()
if (!TARGET_SHEETS.includes(sheet.getName()))
return
const [_, targetColumn] = sheet
.getRange(1, 1, 1, sheet.getMaxColumns())
@oshinko
oshinko / boolify.py
Last active November 10, 2025 03:37
Convert to Boolean
def boolify(value: object) -> bool:
"""
Convert to bool.
>>> falsy = None, False, 0, b'', '', '0', 'false', 'off'
>>> truthy = True, 1, b'\\0', '1', 'true', 'on', 'A'
>>> any(boolify(x) for x in falsy)
False
>>> all(boolify(x) for x in truthy)
True
@oshinko
oshinko / hash-date.js
Last active April 13, 2022 02:42
Hash the date
d = new Date()
s = [d.getFullYear(), d.getMonth() + 1, d.getDate()].join('/')
(async function(text, n) {
data = new TextEncoder().encode(text)
hash = await window.crypto.subtle.digest('SHA-1', data)
uint = new DataView(hash, 0).getUint32()
console.log(text, uint % n)
})(s, 10)
@oshinko
oshinko / img2mp4.py
Last active April 2, 2022 13:12
Convert images to mp4
import pathlib
import subprocess
try:
import cv2
except ModuleNotFoundError:
import sys
subprocess.run(f'{sys.executable} -m pip install opencv-python',
shell=True)
import cv2
@oshinko
oshinko / docker-linux.sh
Last active March 15, 2022 02:21
Run the Linux sandbox container
docker run --rm -it debian:latest /bin/bash
@oshinko
oshinko / docker-mysql-login-via-host.sh
Last active March 31, 2022 09:02
Run the MySQL sandbox container
docker run --rm -it mysql mysql -h host.docker.internal -u root -p --default-character-set=utf8 test