Skip to content

Instantly share code, notes, and snippets.

View patarapolw's full-sized avatar

Pacharapol Withayasakpunt patarapolw

View GitHub Profile
@patarapolw
patarapolw / all-info-expander-all.user.js
Last active March 14, 2023 01:35
Automatically click "Show All Information"
// ==UserScript==
// @name WaniKani All Info Expander
// @namespace http://www.wanikani.com
// @version 0.1
// @description Automatically click "Show All Information"
// @author polv
// @match *://www.wanikani.com/*/session*
// @icon https://www.google.com/s2/favicons?sz=64&domain=wanikani.com
// @grant none
// ==/UserScript==
@patarapolw
patarapolw / custom-font.user.js
Last active December 8, 2022 02:04
Userscript to force certain fonts
// ==UserScript==
// @name Custom font
// @namespace polv/wanikani
// @version 0.1
// @description Custom font for a CSS selector
// @author You
// @match https://www.wanikani.com/*
// @grant none
// ==/UserScript==
@patarapolw
patarapolw / wk-external-definition.user.js
Last active October 1, 2022 22:12
WaniKani External Definition UserScript
// ==UserScript==
// @name WaniKani JJ External Definition
// @namespace http://www.wanikani.com
// @version 0.11.1
// @description Get JJ External Definition from Weblio, Kanjipedia
// @author polv
// @author NicoleRauch
// @match *://www.wanikani.com/*/session*
// @match *://www.wanikani.com/*vocabulary/*
// @match *://www.wanikani.com/*kanji/*
@patarapolw
patarapolw / 0-yomichan-terms.ts
Last active September 3, 2022 14:58
Yomichan Vocab-Kanji lookup
import { ankiConnect } from '@/ankiconnect'
import { kata2hira } from '@/kana'
import { load as cheerio } from 'cheerio'
import { readFileSync, writeFileSync } from 'fs'
async function main() {
const filename = 'tmp/vocab.tsv'
const txt = readFileSync(filename, 'utf-8')
const qs = txt
.split('\n')
@patarapolw
patarapolw / regex-japanese.txt
Created September 2, 2022 16:02 — forked from terrancesnyder/regex-japanese.txt
Regex for Japanese
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@patarapolw
patarapolw / jp-sentence-db.py
Last active August 20, 2022 13:24
Personalized Japanese sentence (from transcript) database, with searching; based on tokenization and POS tagging.
import sqlite3
from pathlib import Path
import regex
import sudachipy
ROOT = Path(__file__).parent
sudachi = sudachipy.Dictionary(dict_type="full").create()
@patarapolw
patarapolw / wk-like-counter.user.js
Last active June 4, 2022 09:25
WaniKani Community Like Counter from https://community.wanikani.com/t/userscript-like-counter/27389 + adapted for mobile
// ==UserScript==
// @name WaniKani Forums: Like counter
// @namespace http://tampermonkey.net/
// @version 3.1.7
// @description Keeps track of the likes you've used and how many you have left... supposedly.
// @author Kumirei
// @include https://community.wanikani.com*
// @grant none
// ==/UserScript==
;(function ($) {
@patarapolw
patarapolw / vue.md
Created April 20, 2022 11:48
Code block language tagging in Github

Vue

<template>
  <input :ref="el => elTextArea = el" />
</template>

HTML

@patarapolw
patarapolw / gh-deploy.sh
Last active October 5, 2022 13:32
Vite on Github Pages with HTML5 History Mode
#!/usr/bin/env bash
set -e
rm -rf dist
GH=1 yarn build
GIT_URL=$(git remote get-url origin)
cd dist
@patarapolw
patarapolw / markdown-preprocess.ts
Last active April 8, 2022 08:09
Markdown pre-processing
const MD_INDEX = 'README'
function mdRemoveIndex(path: string, ext = '.md') {
if (path.endsWith('/' + MD_INDEX + ext)) {
path = path.substring(0, path.length - ext.length - MD_INDEX.length - 1)
}
return path
}