Skip to content

Instantly share code, notes, and snippets.

View ihiroky's full-sized avatar

Hiroki Itoh ihiroky

View GitHub Profile
@ihiroky
ihiroky / 50-keyball61.rules
Created September 1, 2025 13:50
udev rule for keyball61
# Keyball61
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="5957", ATTRS{idProduct}=="0100", MODE="0666"
@ihiroky
ihiroky / daily_reminder.js
Created January 27, 2023 00:26
Google Action Script to send daily notification
function myFunction() {
run('webHookUrl', 'myFunction')
}
function run(webHookUrl, mainFuncName) {
if (isBizDay()) {
const payload = {
text: "デイリーまでにスレッドでみんなに報告しよう!\nテンプレ:\n前日にやったこと\n今日やること\n困ってること・相談したいこと等",
link_names: 1,
};
@ihiroky
ihiroky / export.js
Created January 25, 2023 06:00
Export totp secrets from authy desktop
// Execute `authy --remote-debugging-port=5858`, access to http://localhost:5858 on a web browser, then paste code below in the dev console.
// ref: https://gist.github.com/gboudreau/94bb0c11a6209c82418d01a59d958c93
function hex_to_b32(hex) { let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; let bytes = []; for (let i = 0; i < hex.length; i += 2) { bytes.push(parseInt(hex.substr(i, 2), 16)); } let bits = 0; let value = 0; let output = ''; for (let i = 0; i < bytes.length; i++) { value = (value << 8) | bytes[i]; bits += 8; while (bits >= 5) { output += alphabet[(value >>> (bits - 5)) & 31]; bits -= 5; } } if (bits > 0) { output += alphabet[(value << (5 - bits)) & 31]; } return output; }
console.clear();
console.warn("Here's your Authy tokens:");
var data = appManager.getModel().map(function (i) {
var secretSeed = i.secretSeed;
if (typeof secretSeed == 'undefined') {
@ihiroky
ihiroky / .bashrc
Created July 21, 2022 00:39
CLI oathtool wrapper to get totp token
# mfa completion
function _mfa_comp() {
local cur=${COMP_WORDS[${COMP_CWORD}]}
local opts="$(cat $HOME/.ssh/mfa.txt | cut -f1)"
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
}
complete -F _mfa_comp mfa
@ihiroky
ihiroky / gtk.css
Created May 2, 2022 06:14
gtk.css to adjust (minimum) window title bar height (in .config/gtk-3.0/, .config/gtk-4.0/)
headerbar.default-decoration {
padding-top: 0px;
padding-bottom: 0px;
min-height: 0px;
font-size: 0.6em;
}
headerbar.default-decoration button.titlebutton {
padding: 0px;
min-height: 0px;
@ihiroky
ihiroky / cw_logs.py
Created February 1, 2022 05:06
Print CloudWatch log stream to stdout
#!/usr/bin/python3
#
# Print CloudWatch log stream to stdout.
# Referring to https://qiita.com/shinsaka/items/23a37873a23bdc2fc7fb
#
import boto3
from datetime import datetime
import sys
@ihiroky
ihiroky / remove_disabled_snap.sh
Created December 13, 2021 01:54
Script which removes all disabled versions of snaps.
#!/bin/bash -e
LANG=C snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
#!/bin/bash
for f in com.visualstudio.code firefox simplescreenrecorder brave-browser
do
find ./WhiteSur/ -name "*${f}*" -exec rm -f {} \;
find ./WhiteSur-dark/ -name "*${f}*" -exec rm -f {} \;
done
rm -f ./WhiteSur/icon-theme.cache
rm -f ./WhiteSur-dark/icon-theme.cache
gtk-update-icon-cache ./WhiteSur/
@ihiroky
ihiroky / waitFor.ts
Created October 13, 2021 00:00
Wait until validateSync() throws nothing.
function waitFor(validateSync: () => void, timeout = 1000, checkInterval = 50): Promise<void> {
const start = Date.now()
let elapsed = 0
return new Promise<void>((resolve: () => void, reject: (reason: unknown) => void): void => {
const check = (): void => {
try {
validateSync()
resolve()
return
} catch (e: unknown) {
@ihiroky
ihiroky / vbox_bigsur_settings.txt
Last active October 13, 2021 04:48
Virtual Box settings to install OSX Big Sur
# from https://www.wikigain.com/how-to-install-macos-big-sur-on-virtualbox-on-windows-pc/
vboxmanage modifyvm "iMac" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
vboxmanage setextradata "iMac" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac19,1"
vboxmanage setextradata "iMac" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
vboxmanage setextradata "iMac" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-AA95B1DDAB278B95"
vboxmanage setextradata "iMac" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
vboxmanage setextradata "iMac" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
# Change display resolution
vboxmanage setextradata "iMac" "VBoxInternal2/EfiGraphicsResolution" 1440x900