Skip to content

Instantly share code, notes, and snippets.

Avatar
i love coffee

AWtnb AWtnb

i love coffee
View GitHub Profile
@AWtnb
AWtnb / youtube-embed-lazy.js
Last active Jan 27, 2023
snippet for youtube embed (lazy-load)
View youtube-embed-lazy.js
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);
},
@AWtnb
AWtnb / hidemaru.md
Created Dec 20, 2022
秀丸エディタ設定メモ
View hidemaru.md

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

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

image

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

image

@AWtnb
AWtnb / diff-wrapper.css
Last active May 31, 2022
Stylesheet to decorate Python HtmlDiff-generated html
View diff-wrapper.css
* {font-family: "PlemolJP";}
table {
margin: 20px auto;
border: 1px solid #aaa;
}
thead, th, tbody {border: 1px solid #aaa;}
th {background:#e0e0e0;}
td {
border-left: 1px solid #aaa;
border-right: 1px solid #aaa;
@AWtnb
AWtnb / get_default_browser.py
Created May 20, 2022
get default browser path with Python (on Windows10)
View get_default_browser.py
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 / setting.json
Last active May 19, 2022
Thunderbird tbkeys-lite setting
View setting.json
{
"0": "unset",
"1": "unset",
"2": "unset",
"3": "unset",
"4": "unset",
"5": "unset",
"6": "unset",
"7": "unset",
"8": "unset",
@AWtnb
AWtnb / mokof.go
Last active Apr 23, 2022
fuzzy-filter for PowerShell
View mokof.go
package main
import (
"bufio"
"flag"
"fmt"
"os"
"github.com/ktr0731/go-fuzzyfinder"
)
@AWtnb
AWtnb / ToggleSplitPaneVertical2.js
Created Apr 23, 2022
Tablacus explorer customize: Duplicate the current tab to the side pane (開いているタブを横のペインに複製する)
View ToggleSplitPaneVertical2.js
// https://gist.github.com/tablacus/b706707ae86aa4fd7d126d5d117a853d
// Toggle split pane (Vertical) Require "Split" - Tablacus Explorer
function ToggleSplitPaneVertical() {
if (te.Ctrls(CTRL_TC, true).Count > 1) {
Addons.Split.Exec(1, 1);
} else {
Addons.Split.Exec(2, 3);
// https://github.com/tablacus/TablacusExplorerAddons/wiki/switchpane
Sync.SwitchPane.NextFV().Navigate(GetFolderView(), SBSP_NEWBROWSER);
}
@AWtnb
AWtnb / bank-code.py
Created Mar 14, 2022
search bank name and branch name with zengin-py
View bank-code.py
"""
銀行と支店コードを検索
"""
import argparse
from zengin_code import Bank
def format_name(s:str):
from_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-ャュョッ"
@AWtnb
AWtnb / WHOLE.py
Last active Sep 28, 2022
python-script-called-from-PowerShell | 個人用バックアップ($Profile から呼び出す .py スクリプトを集約)
View WHOLE.py
""" #############################################################
##
## BEGINING OF FILE:
## ~\Documents\PowerShell\cmdlets\python\sudachi_tokenizer.py
##
############################################################# """
"""
@AWtnb
AWtnb / BackOrOutdent.js
Last active Mar 18, 2021
テキストエディタ Mery 用の自作マクロ集。
View BackOrOutdent.js
// ------------------------------------------------------------
// インデント直後では逆インデント、それ以外は直前の1字を削除
// ------------------------------------------------------------
function selectLine() {
document.selection.EndOfLine(false, mePosLogical);
document.selection.StartOfLine(true, mePosLogical);
}
function getIndentDepth(s) {