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 / 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 / get_termsize.rb
Last active May 1, 2023 16:22
端末のサイズ(列数,行数)を取得
# @name get_termsize.rb
# @desc 端末のサイズ(列数,行数)を取得
=begin
man
http://linuxjm.sourceforge.jp/html/LDP_man-pages/man4/tty_ioctl.4.html
/usr/include/sys/termios.h
@s-hiiragi
s-hiiragi / jump_to_sheet.bas
Created October 1, 2020 13:14
指定したシートにジャンプするExcel VBAマクロ
Sub 指定したシートにジャンプ()
Dim SheetPattern As String
Dim s As Variant
SheetPattern = LCase(InputBox("シート名を入力", "指定したシートにジャンプ", ""))
If SheetPattern = "" Then
Exit Sub
End If
For Each s In ActiveWorkbook.Sheets
@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
Created October 6, 2022 16:01
(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('&')
@s-hiiragi
s-hiiragi / print_attrs.py
Created September 19, 2022 17:16
オブジェクトのメソッドとプロパティを継承元ごとに表示
def print_attrs(value):
from functools import reduce
mro = type(value).mro()
attrsets = [set(dir(x)) for x in mro] + [set()]
ownattrsets = [x - attrsets[i+1] for i,x in enumerate(attrsets) if i < len(mro)]
for type_, ownattrset in zip(mro, ownattrsets):
print(type_.__name__)
print(' ', list(ownattrset))