Skip to content

Instantly share code, notes, and snippets.

View kuanyui's full-sized avatar
❄️
なんでそんなに慣れてんだよ!

クエン酸 kuanyui

❄️
なんでそんなに慣れてんだよ!
View GitHub Profile
function cliPrompt<T = string>(promptMsg: string): Promise<T> {
return new Promise((resolve, reject) => {
process.stdin.on("data", function(data: any) {
resolve(data.toString())
process.stdin.end()
})
process.stdout.write(promptMsg);
})
}
// ==UserScript==
// @name Mastodon Anti-zh_CN Filters Installer
// @grant none
// @version 1.2
// @match https://pawoo.net/filters
// @match https://pawoo.net/filters/new
// @run-at document-end
// ==/UserScript==
// [USAGE]
// 1. Change "@match" to the filter page of the Mastodon instance you're using ("Perference -> Filters")
@kuanyui
kuanyui / renameunix2win.py
Created October 17, 2022 10:52
To rename files in ext4 to exFAT. Forked from https://askubuntu.com/a/671466/442465
#!/usr/bin/env python3
import os
import shutil
import sys
if len(sys.argv) == 1:
print('[USAGE] Please provide directory in argv.')
exit(1)
directory = sys.argv[1]
@kuanyui
kuanyui / Makefile
Created October 17, 2022 02:36
Auto use nvm & gvm in Makefile
.ONESHELL: # This ".ONESHELL" is important!
define GVM_USE
echo "========================================================================================="
echo "[INFO] Recommended Go Version: 1.9"
source "${GVM_ROOT}/scripts/gvm" # Or source "${HOME}/.gvm/scripts/gvm"
gvm use go1.9
echo "[INFO] Remember to git checkout in ~/.gvm/pkgsets/go1.9/global/src/github.com/........"
echo "========================================================================================="
endef
@kuanyui
kuanyui / Makefile
Created August 24, 2022 11:55
auto `nvm use` in Makefile
.ONESHELL:
.PHONY: clear build watch server
default: watch
GULP:="./node_modules/.bin/gulp"
define NVM_USE
source ~/.nvm/nvm.sh
nvm use v14.20.0
endef
@kuanyui
kuanyui / mscorex.sh
Created August 16, 2022 13:55
Launch MuseScore until success
#!/bin/bash
# https://stackoverflow.com/questions/1570262/get-exit-code-of-a-background-process
mscore > /dev/null 2>&1 &
MS_PID=$!
while true
do
# if string.length == 0
@kuanyui
kuanyui / Makefile
Last active March 11, 2022 08:49
Colors in console (NodeJS, Makefile)
ifneq (,$(findstring xterm,${TERM}))
DARK_BLACK := $(shell tput setaf 0)
DARK_RED := $(shell tput setaf 1)
DARK_GREEN := $(shell tput setaf 2)
DARK_YELLOW := $(shell tput setaf 3)
DARK_BLUE := $(shell tput setaf 4)
DARK_MAGENTA := $(shell tput setaf 5)
DARK_CYAN := $(shell tput setaf 6)
DARK_WHITE := $(shell tput setaf 7)
BLACK := $(shell tput setaf 8)
@kuanyui
kuanyui / Makefile
Created March 11, 2022 07:21 — forked from rsperl/Makefile #snippet
self-documenting makefile with colors
SHELL=/bin/bash
# to see all colors, run
# bash -c 'for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done'
# the first 15 entries are the 8-bit colors
# define standard colors
ifneq (,$(findstring xterm,${TERM}))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
[ 0.000000] microcode: microcode updated early to revision 0xea, date = 2021-01-05
[ 0.000000] Linux version 5.15.11-arch2-1-surface (linux-surface@archlinux) (gcc (GCC) 11.1.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP PREEMPT Sat, 25 Dec 2021 15:09:08 +0000
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-linux-surface root=UUID=30e1781a-10a9-499f-8a48-1c259aadd349 rw apparmor=1 security=apparmor udev.log_priority=3
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x008: 'MPX bounds registers'
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x010: 'MPX CSR'
[ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
[ 0.000000] x86/fpu: xstate_offset[3]: 832, xstate_sizes[3]: 64
@kuanyui
kuanyui / Makefile
Last active November 14, 2021 14:45
Makefile for extracting dictionaries directories.
SRC:=tar
DIST:=dist
PROC_NUM:=8
# find tar -type f -regextype posix-extended -regex 'tar/(ja|en)/.*' | xargs -I '{}' echo tar -xvf '{}'
mkdir:
mkdir -p $(DIST)
clear:
rm -rf $(DIST)/*