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 / gomibako.bat
Created September 13, 2021 21:19
ごみ箱を開くバッチファイル
@explorer shell:RecycleBinFolder
@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 / sample1.py
Created August 5, 2020 19:03
A generated sample code
from freestanding import homespun
from nightlong import toad as cartel
import sprung as venom
import inscrutable as scrip
from thermoelectric import infamy
import priming as dandle
from propylene import smashing
import accretion
from furring import crappy
@s-hiiragi
s-hiiragi / traceback_with_values.py
Created April 28, 2020 19:20
Display a traceback with variables in the statement where the error occurred
# coding: utf-8
r"""
Sample output:
C:\Users\USERNAME\repos\python3-exception-with-values>python traceback_with_values.py
Traceback (most recent call last):
File "traceback_with_values.py", line 45, in <module>
print(float(x) + y)
@s-hiiragi
s-hiiragi / longname2short.py
Created March 5, 2020 16:14
Convert long file names to short file names in current directory
import os
from ctypes import windll, create_unicode_buffer
dll = windll.LoadLibrary('kernel32.dll')
for longname in os.listdir('.'):
shortname = create_unicode_buffer(16)
dll.GetShortPathNameW(longname, shortname, 16)
if shortname.value.lower().endswith('2.csv'):
print('from:', longname)
@s-hiiragi
s-hiiragi / genfile2.py
Created March 5, 2020 15:03
Generate files with random names
# > python --version
# Python 3.8.2
# > python genfile2.py -n 100000 --max 200
# > attrib *2.csv
import sys
import random
import argparse
from pathlib import Path
@s-hiiragi
s-hiiragi / KingBladeX10V.puml
Created January 9, 2020 12:09
State machine diagram of KING BLADE X10 V
@startuml "State machine diagram of KING BLADE X10 V"
[*] --> ColorChange : A0.5秒押し(電源ON)
[*] --> ColorChange : A1.5秒押し(色1で電源ON)
[*] --> MemorySetA : B長押し
[*] --> MemorySetB : A&B長押し
ColorChange --> ColorChange : A/B(次/前の色を選択)
ColorChange --> ColorChange : C長押し(推し色を設定)
ColorChange --> HotButton : C(推し色に変更)
@s-hiiragi
s-hiiragi / b.txt
Created July 17, 2019 19:12
study gist
b
@s-hiiragi
s-hiiragi / shortcutkey_settings.json
Last active July 17, 2019 19:21
Settings of 'Shortkeys' google chrome extension for DOVA-SYNDROME (dova-s.jp)
[{"action":"javascript","blacklist":"whitelist","code":"iframe = document.querySelector('#YouTube > iframe')\nid = iframe.src.match(/([0-9a-zA-Z]+)?$/)[0]\nhistory.go(id?-1:-2)","customName":"Go back","exported":true,"key":"a","open":false,"sites":"https://dova-s.jp/bgm/play*","sitesArray":["https://dova-s.jp/bgm/play*"]},{"action":"javascript","blacklist":"whitelist","code":"console.log('-- Play youtube movie')\niframe = document.querySelector('#YouTube > iframe')\nid = iframe.src.match(/([0-9a-zA-Z]+)?$/)[0]\nif (id) {\n\tiframe.src += `?autoplay=1&playlist=${id}&muted=1&`\n playedBgms = JSON.parse(localStorage.getItem('playedBgms')) || {}\n \ttitle = document.querySelector('#titleYouTube > h2').firstChild.textContent.trim()\n playedBgms[location.pathname] = title\n localStorage.setItem('playedBgms', JSON.stringify(playedBgms))\n console.log(playedBgms)\n} else {\n \thistory.go(-2)\n}","customName":"Play bgm","exported":true,"key":"space","open":false,"sites":"https://dova-s.jp/bgm/play*","sit
@s-hiiragi
s-hiiragi / ast_practice_1.py
Created April 16, 2018 17:11
ast practice 1
import ast
source = """
name = "Inu"
age = 10
print("Hello, {}({})!".format(name, age))
"""
tree = ast.parse(source)