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 / 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)
@s-hiiragi
s-hiiragi / selection_sample.js
Last active February 7, 2017 15:56
選択範囲をレイアウト座標とロジック座標で相互変換するサクラエディタマクロのサンプル
/**
* @file sakura_selection_sample.js
*
* 注:Shift_JISで保存してください (サクラエディタマクロの制約事項)
*/
/**
* 選択範囲(レイアウト座標)
*
* @param {number} lineFrom 選択開始行(レイアウト座標)
@s-hiiragi
s-hiiragi / flag_sample.go
Created February 6, 2017 15:12
Goでコマンドライン引数をパースするサンプル
/*
* $ go run flag_sample.go -i 100 -s "strflag" 1 2 3
* os.Args: [/.../os_args_sample -i 100 -s strflag 1 2 3]
* flag.Args: [1 2 3]
* b: false
* i: 100
* s: strflag
*/
package main
@s-hiiragi
s-hiiragi / flagset_sample.go
Last active February 6, 2017 12:21
Goで配列をコマンドラインとしてパースするサンプル
package main
import (
"flag"
"fmt"
)
func main() {
var (
boolFlag bool
@s-hiiragi
s-hiiragi / csv_read_sample.go
Last active February 6, 2017 12:19
GoでCSVファイルを読み込むサンプル
package main
import (
"fmt"
"os"
"io"
"encoding/csv"
)
func main() {
@s-hiiragi
s-hiiragi / exec_sample.go
Created February 6, 2017 00:00
Goで外部コマンドを実行して標準出力を得るサンプル
package main
import (
"fmt"
"log"
"os/exec"
)
func main() {
out, err := exec.Command("ls", "-l").Output()