Skip to content

Instantly share code, notes, and snippets.

View s-hiiragi's full-sized avatar

s_hiiragi s-hiiragi

View GitHub Profile
@s-hiiragi
s-hiiragi / combination.py
Created February 16, 2025 04:51
nCkの組合せのリストを生成する
# https://x.com/ellnore_pad_267/status/1889922279750160791/photo/1
N = 5
k = 3
t = [None] * k
r = []
print(f'{N=}, {r=}, {t=}')
def combination(x, i, prefix, indent):
sp = '^ ' * indent
print(f'{prefix}{sp}({x}, {i})')
@s-hiiragi
s-hiiragi / cleanup_on_close.ps1
Last active December 13, 2024 14:29
ウィンドウを閉じるとクリーンアップ処理を開始するスクリプト
Param(
# 内部的な引数
[switch]$Hidden,
# 内部的な引数
[switch]$Perform
)
if (-not $Hidden -and -not $Perform) {
# PowerShellウィンドウを非表示で実行
powershell -WindowStyle Hidden -File $MyInvocation.MyCommand.Path -Hidden
@s-hiiragi
s-hiiragi / excel_toggle_auto_complete.bas
Last active December 6, 2024 22:08
(Excel) オートコンプリートを切り替える
' オートコンプリートを切り替える
'
' 以下のオプションをON/OFFします
' オプション>詳細設定>編集オプション>オートコンプリートを有効にする
'
Sub オートコンプリート切替()
Application.EnableAutoComplete = Not Application.EnableAutoComplete
MsgBox "オートコンプリートを" & IIf(Application.EnableAutoComplete, "有効", "無効") & "にしました"
End Sub
@s-hiiragi
s-hiiragi / convert_statusid_to_datetime.js
Last active April 2, 2024 12:25
Convert Twitter Status Id to DateTime
const status_id = BigInt(prompt('Input Status Id', ''));
const timestamp = Number((status_id >> 22n) + 1288834974657n);
const s = new Date(timestamp).toLocaleString();
console.log(s);
@s-hiiragi
s-hiiragi / bookmarklet_yt_show_lag_message.js
Created March 2, 2024 08:47
(YouTube) DVRでズレている時にメッセージを表示
javascript:(()=>{
const eVideo = document.querySelector('video.video-stream');
const eProgressBar = document.querySelector('.ytp-progress-bar');
const eMessage = document.createElement('div');
eMessage.style.cssText = 'color: red; font-size: 16px;';
const eContainer = document.querySelector('#chat-container');
eContainer.parentNode.insertBefore(eMessage, eContainer.nextSibling);
const makeLagMessage = (s) => `リアルタイムから${s}秒ズレています。`;
@s-hiiragi
s-hiiragi / bookmarklet_yt_hidden_related.js
Last active February 25, 2024 12:46
(YouTube) 右端の関連動画を非表示するブックマークレット
@s-hiiragi
s-hiiragi / uwsc_recording_methods.md
Last active March 23, 2023 17:48
UWSC 記録方法ごとの違い

UWSC 記録方法ごとの違い

Windows 10の電卓アプリで1+1=を記録してみる

低レベル記録

MMV(1038,913,203)
MMV(1040,913,15)
MMV(1046,913,15)
@s-hiiragi
s-hiiragi / join_ranges.bas
Created October 8, 2022 16:30
(Excel VBA) 複数のセル範囲を結合して返すサンプル
' 複数のセル範囲を結合する
Function JoinRanges(ParamArray rs() As Variant)
Dim c As Long
Dim i As Long
Dim k As Long
Dim r As Variant
Dim z() As Variant
c = 0
@s-hiiragi
s-hiiragi / join_range.bas
Created October 7, 2022 18:38
(Excel VBA) 2つのセル範囲を結合して返すサンプル
' 2つのセル範囲を結合する
Function JoinRange(x As Range, y As Range)
Dim xCnt As Long
Dim yCnt As Long
Dim i As Long
Dim z()
xCnt = x.Count
yCnt = y.Count
@s-hiiragi
s-hiiragi / bookmarklet-create-issue-template-url.js
Last active October 18, 2024 18:43
(Redmine) 新しいチケットページの入力項目からチケットテンプレートURLを作成
javascript:(()=>{
const namedItems = Array.from(document.querySelectorAll('#issue-form [name]'))
.filter(e => e.value)
.filter(e => ! e.type?.match(/^(hidden|submit|button)$/))
.filter(e => ! e.name.match(/^issue\[(project_id|status_id|priority_id|start_date)\]$/))
;
const search = namedItems
.map(e => `${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`)
.join('&')