Skip to content

Instantly share code, notes, and snippets.

@mandel59
mandel59 / jgquery.sql
Last active July 13, 2022 19:03
https://twitter.com/mandel59/status/1547293802565496832 常用漢字と対応する規範字で画数を比べて、常用漢字の方が画数が少ない字を抜き出したもの。元ネタ: https://twitter.com/tubatuubaa/status/1547122155116146688
-- SQLite
WITH
joyo_itaiji (常用漢字, 異体字) AS (
SELECT DISTINCT joyo_kangxi.漢字 AS 常用漢字, joyo_kangxi.康熙字典体 AS 異体字
FROM joyo_kangxi
UNION
SELECT DISTINCT joyo.漢字, joyo.漢字
FROM joyo
),
joyo_zvar (常用漢字, 異体字) AS (
@mandel59
mandel59 / minecraft_dye.md
Created May 29, 2022 13:17
Minecraft dye recipes

マインクラフト 染料のレシピ

flowchart LR
    white_dye[白色の染料]
        bone_meal[骨粉] --> white_dye
        lily_of_the_valley[スズラン] --> white_dye

    light_gray_dye[薄灰色の染料]
        black_dye --> bw_light_gray_dye
@mandel59
mandel59 / mojibake.js
Last active December 3, 2021 01:49
https://twitter.com/needle/status/1466336299703422977 の文字化けを解読する時に使ったスクリプト
function* range(a, b) {
for (let i = a; i <= b; i++) {
yield i;
}
}
function* decode(s) {
const b = Buffer.from(s, "latin1");
if (b.length === 1) {
for (const i of range(0x80, 0x9f)) {
@mandel59
mandel59 / collatz.js
Created September 6, 2021 08:09
コラッツの数列を表示
let i = BigInt(Deno.args[0]);
while (true) {
if (i <= 0n) throw new RangeError();
console.log(String(i));
if (i === 1n) break;
if (i % 2n === 0n) {
i /= 2n;
} else {
i = i * 3n + 1n;
}
@mandel59
mandel59 / gist:e094c5bf2e504760fe2c0d139551a0f3
Last active June 24, 2021 04:17
有名人一覧 https://www.ntv7.jp/sitemap/talent_list.html の名前を処理して、2通りの分割ができるようにしたもの https://twitter.com/hakodumepuz/status/1407853350406688774
マリ|アイザワマキ|マリア|イザワマキ
ユリ|アイザワマキ|ユリア|イザワマキ
レイ|アイザワマキ|レイア|イザワマキ
マリ|アイハラユウ|マリア|イハラユウ
ユリ|アイハラユウ|ユリア|イハラユウ
レイ|アイハラユウ|レイア|イハラユウ
ハヅキ|アイミチコ|ハヅキアイ|ミチコ
ハヅキ|アイヨウコ|ハヅキアイ|ヨウコ
ハヅキ|アイリサ|ハヅキアイ|リサ
ユウキ|アオイユウ|ユウキアオイ|ユウ
@mandel59
mandel59 / jpcal.ts
Created May 23, 2021 11:46
日本の暦でカレンダーを表示する
import { parse } from "https://deno.land/std@0.95.0/flags/mod.ts"
import { TextDecoder } from 'https://cdn.skypack.dev/text-decoding'
const sjisDecoder = new TextDecoder("shift-jis")
const typeOptions = new Map([
[0, "西暦から和暦へ変換"],
[1, "和暦から西暦へ変換"],
[2, "太陰太陽暦の朔日"],
])
@mandel59
mandel59 / widthlist.py
Created April 11, 2021 02:24
フォント名とグリフ名とUnicodeコードポイントとグリフ幅を出力するだけのスクリプト
import sys
import fontforge
def processFont(filename):
font = fontforge.open(filename)
try:
for glyph in font.glyphs():
if glyph.unicode != -1:
print("%s,%s,%d,%d" % (filename, glyph.glyphname, glyph.unicode, glyph.width))
// SPDX-License-Identifier: MIT-0
/*
* Copyright 2021 Ryusei Yamaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so.
@mandel59
mandel59 / LICENSE.md
Created March 24, 2021 03:04
This is inverted list of kPhonetic values of Unihan-14.0.0d3.

UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE

See Terms of Use for definitions of Unicode Inc.'s Data Files and Software.

NOTICE TO USER: Carefully read the following legal agreement.

BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.

COPYRIGHT AND PERMISSION NOTICE

@mandel59
mandel59 / star-first.user.js
Created December 2, 2020 01:38
star-first.user.js
// ==UserScript==
// @name star-first
// @namespace https://ryusei.dev/
// @version 0.1
// @description Star before you submit an issue
// @author Ryusei Yamaguchi
// @match https://github.com/*/*/issues/*
// @grant none
// ==/UserScript==