Skip to content

Instantly share code, notes, and snippets.

View book000's full-sized avatar
👀
record User(String nickName, String screenName, Location country){}

Tomachi book000

👀
record User(String nickName, String screenName, Location country){}
View GitHub Profile
@book000
book000 / compose.yaml
Last active May 10, 2023 02:17
Docker Compose file for elasticsearch & kibana
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.13.1
environment:
- discovery.type=single-node
- LOGSPOUT=ignore
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- xpack.watcher.enabled=false
@book000
book000 / pixiv-full-image.user.js
Last active April 30, 2024 11:42
Replace square images displayed on pixiv.net with full-size images
// ==UserScript==
// @name pixiv replace full image
// @namespace https://tomacheese.com
// @version 1.0.1
// @description Replace square images displayed on pixiv.net with full-size images
// @author Tomachi
// @match https://www.pixiv.net/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=pixiv.net
// @updateURL https://gist.github.com/book000/0326c9b0635d99b7c4ab891ccb5e67be/raw/pixiv-full-image.user.js
// @downloadURL https://gist.github.com/book000/0326c9b0635d99b7c4ab891ccb5e67be/raw/pixiv-full-image.user.js
@book000
book000 / mitmproxy-all-write-file.py
Last active May 3, 2023 12:10
mitmproxyですべての通信をファイルに書き出すアドオン
import json
from pprint import pprint
from mitmproxy import addonmanager, http
from mitmproxy import tls
from urllib.parse import urlparse
from mitmproxy import ctx
import os
from datetime import datetime
#!/bin/bash
cd "$(dirname "$0")" || exit
progress() {
local message=$1
local space
space=$(printf '%*s' $(( $(tput cols) - ${#message} )) ' ')
echo -ne "$message$space\r"
}
@book000
book000 / rdp-connect.bat
Created January 27, 2023 01:11
imniko/SetDPI でWindowsディスプレイの拡大率設定を 100% にしたうえで RDP する bat
@echo off
echo [INFO] SetDPI 100
SetDPI.exe 1 100
echo [INFO] Connect RDP
start C:\Windows\System32\mstsc.exe "C:\Users\Tomachi\ICHIGO-MULTI-REMOTE.rdp"
timeout /T 10 /NOBREAK
:check
#!/bin/bash
if [[ $# -ne 2 ]]; then
echo "Error: 2つの引数が必要です。1つ目にscreenの名前、2つ目にURLを指定してください。"
exit 1
fi
SCREEN_NAME=$1
shift
# shellcheck disable=SC2068
screen -dmS "${SCREEN_NAME}" /usr/bin/yt-dlp -o "/mnt/hdd/yt-dlp-live/%(title)s.%(ext)s" --hls-use-mpegts --wait-for-video 10 $@
import json
def json2csv(username: str):
with open("data/" + username + ".json") as f:
items = json.load(f)
rows = []
for item in items:
for result in item["results"]:
@book000
book000 / README.md
Last active January 26, 2025 11:50
manaba2moodle

manaba2moodle

manaba でエクスポートした mht ファイルを moodle の問題バンクにインポートできるように Moodle XML 形式に変換する簡易スクリプトです。

  • main.ts (yarn build): すべての問題を穴埋め問題(Cloze)で作成します。
    作成した問題は xml/cloze/ ディレクトリの下に国語(J)、数学(M)、英語(E)と教科ごとに作成されます。
  • main-new.ts (yarn build-new): 選択式問題をmultichoiceで対応、空所入力問題をshortanswerで作成します。
    作成した問題は xml/not-cloze/ ディレクトリの下に大問ごとにファイルを分けて作成されます。

ライセンスは一応 MIT License です。

@book000
book000 / add-reviewer.yml
Last active April 16, 2022 10:01
プルリクがオープンされたときにbook000をレビュアーに追加する
# 自動的にbook000をレビュアーにする
# book000, renovate, github-actionsからのPull-Requestにはレビュアーを追加しない
# 次の設定が必要:
# Settings -> Actions -> General -> Fork pull request workflows from outside collaborators -> Require approval for first-time contributors who are new to GitHub
name: Add reviewer
on:
pull_request_target:
@book000
book000 / git-rm-merged-branch.bat
Created April 13, 2022 08:19
マージ済みローカルブランチを削除する (WSL利用)
@echo off
git fetch --all
git checkout master
git fetch --prune
bash -c "git branch --merged | egrep -v '\*|develop|main|master'| xargs git branch -d"