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 / 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('&')
@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))
@s-hiiragi
s-hiiragi / bookmarklet-amazon-orders.js
Last active September 10, 2022 21:01
Amazonの注文履歴を取得するブックマークレット
javascript:(()=>{
const orders = Array.from(document.querySelectorAll('#ordersContainer > .order'));
let records = orders.flatMap(order => {
const id = order.querySelector('.yohtmlc-order-id .value').textContent.trim();
const date = order.querySelector('.a-span3 .value').textContent.trim();
const total = order.querySelector('.yohtmlc-order-total .value').textContent.trim();
const itemTitles = Array.from(
order.querySelectorAll('.yohtmlc-item > .a-row:nth-child(1)')).
map(e => e.textContent.trim());
@s-hiiragi
s-hiiragi / HSPの演算子の優先順位.md
Created January 14, 2022 17:32
HSPの演算子の優先順位

HSPの演算子の優先順位

演算子の一覧

演算子 種類
+,-,*,/ 加算,減算,乗算,除算
&,|,^ 論理演算(and,or,xor)
\ 割り算の余り
=,<,>,! 条件式(同じ,小さい,大きい,同じでない)