Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View AWtnb's full-sized avatar
i love coffee

AWtnb AWtnb

i love coffee
View GitHub Profile
@AWtnb
AWtnb / fontchecker.ps1
Created April 21, 2024 05:20
Check RTF font information inside clipboard with Windows Powreshell
function Get-ClipboardFontInfo {
Add-Type -AssemblyName System.Windows.Forms
$cb = [System.Windows.Forms.Clipboard]::GetData([System.Windows.Forms.DataFormats]::Rtf)
if (-not $cb) {
"フォント情報がコピーされていません……" | Write-Host
return
}
$rtb = [System.Windows.Forms.RichTextBox]::new()
$rtb.Rtf = $cb
@AWtnb
AWtnb / init.lua
Last active March 2, 2024 00:51
CorvusSKK init.lua
--[[
CorvusSKK Lua拡張スクリプト
Cから呼ばれるLuaの関数
辞書検索
lua_skk_search(key, okuri)
key : 見出し語 string
okuri : 送り仮名 string
@AWtnb
AWtnb / dictation.py
Created February 6, 2024 05:59
Whisperでローカル文字起こし
import argparse
import os
from pathlib import Path
import whisper
def main(infile: str) -> None:
in_path = Path(infile)
out_path = in_path.with_name(in_path.stem + ".txt")
@AWtnb
AWtnb / sushi-yunomi.ps1
Created November 12, 2023 03:21
寿司屋の湯呑に使えそうな魚偏の漢字を出力
0x9b5a..0x9ce4|% {[char]::ConvertFromUtf32($_)}
@AWtnb
AWtnb / vivadon-min.ps1
Last active November 20, 2023 23:31
バッ丼ッビビビビビバッッビビッバババ丼ッバ丼ビッバビビビッビッビッバビッババッッ ビバ丼
$ss=@();echo ビ バ 丼 ッ|sv a;while(1){$ss+=$a[(Get-Random)%4];if($a.count -gt 2 -and(-join($ss|select -Last 3))-eq"ビバ丼") {break}}; -join $ss
@AWtnb
AWtnb / mokof.go
Last active July 23, 2023 11:38
fuzzy-filter for PowerShell
package main
import (
"bufio"
"flag"
"fmt"
"os"
"github.com/ktr0731/go-fuzzyfinder"
)
@AWtnb
AWtnb / get_default_browser.py
Created May 20, 2022 01:39
get default browser path with Python (on Windows10)
import re
from winreg import HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, OpenKey, QueryValueEx
def get_browser_name() -> str:
register_path = r'Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice'
with OpenKey(HKEY_CURRENT_USER, register_path) as key:
return str(QueryValueEx(key, "ProgId")[0])
def format_cmd(s:str) -> str:
exe_path = re.sub(r"(^.+exe)(.*)", r"\1", s)
@AWtnb
AWtnb / format_kangxi.py
Created July 6, 2023 02:01
python function to format kangxi radicals
def format_kangxi(s):
mapping = { "\u2f00":"\u4e00", "\u2f01":"\u4e28", "\u2f02":"\u4e36", "\u2f03":"\u4e3f", "\u2f04":"\u4e59", "\u2f05":"\u4e85", "\u2f06":"\u4e8c", "\u2f07":"\u4ea0", "\u2f08":"\u4eba", "\u2f09":"\u513f", "\u2f0a":"\u5165", "\u2f0b":"\u516b", "\u2f0c":"\u5182", "\u2f0d":"\u5196", "\u2f0e":"\u51ab", "\u2f0f":"\u51e0", "\u2f10":"\u51f5", "\u2f11":"\u5200", "\u2f12":"\u529b", "\u2f13":"\u52f9", "\u2f14":"\u5315", "\u2f15":"\u531a", "\u2f16":"\u5338", "\u2f17":"\u5341", "\u2f18":"\u535c", "\u2f19":"\u5369", "\u2f1a":"\u5382", "\u2f1b":"\u53b6", "\u2f1c":"\u53c8", "\u2f1d":"\u53e3", "\u2f1e":"\u56d7", "\u2f1f":"\u571f", "\u2f20":"\u58eb", "\u2f21":"\u5902", "\u2f22":"\u590a", "\u2f23":"\u5915", "\u2f24":"\u5927", "\u2f25":"\u5973", "\u2f26":"\u5b50", "\u2f27":"\u5b80", "\u2f28":"\u5bf8", "\u2f29":"\u5c0f", "\u2f2a":"\u5c22", "\u2f2b":"\u5c38", "\u2f2c":"\u5c6e", "\u2f2d":"\u5c71", "\u2f2e":"\u5ddb", "\u2f2f":"\u5de5", "\u2f30":"\u5df1", "\u2f31":"\u5dfe", "\u2f32":"\u5e72", "\u2f33":"\u5e7a"
@AWtnb
AWtnb / hidemaru.md
Last active June 27, 2023 11:28
秀丸エディタ設定メモ

秀丸エディタおすすめ設定集

諸々の基本設定はメニューバーの その他ファイルタイプ別の設定 で変更可能。

image

ファイルタイプ別 というのはつまり、 .txt などの拡張子別に設定を変更できるという意味。(共通) で適用した設定は基本的にどのファイルにも受け継がれる。

image

@AWtnb
AWtnb / youtube-embed-lazy.js
Last active January 27, 2023 10:18
snippet for youtube embed (lazy-load)
Array.from(document.querySelectorAll(".youtube")).forEach((el) => {
el.addEventListener(
"click",
() => {
const src = el.getAttribute("data-video");
const newDiv = document.createElement("div");
newDiv.classList.add("youtubeplay");
newDiv.innerHTML = `<iframe loading="lazy" src="${src}" frameborder="0" width="560" height="315"></iframe>`;
el.replaceWith(newDiv);
},