Skip to content

Instantly share code, notes, and snippets.

View exkuretrol's full-sized avatar
😾
Focusing

Chiawei Chen exkuretrol

😾
Focusing
View GitHub Profile
@exkuretrol
exkuretrol / gist:732970e6ae39c08203eb99887c09b752
Last active July 10, 2026 01:27
Reset the MariaDB Root Password on Unraid

This procedure temporarily starts the MariaDB Docker container with authentication disabled, resets the root password through the container console, and then restores the normal container configuration.

Warning: Back up the MariaDB appdata/database directory before proceeding. While --skip-grant-tables is enabled, MariaDB authentication is disabled.

1. Save the existing container configuration

  1. Open the Unraid Docker page.
  2. Click the MariaDB container icon and select Edit.
  3. Temporarily change any value.
  4. Change the value back to its original setting.
@exkuretrol
exkuretrol / bookmarklet.js
Created June 6, 2026 09:26
減碳存摺自動填資料送出 bookmarklet
javascript:(()=>{const D={name:"王小明",phone:"0912345678",email:"you@example.com",address:"台北市信義區市府路1號"};const f=document.querySelector('form[id^="gform_"]');if(!f){alert('找不到表單');return}const set=(el,v)=>{if(!el||!v)return;el.value=v;el.dispatchEvent(new Event('input',{bubbles:true}));el.dispatchEvent(new Event('change',{bubbles:true}))};const pick=ks=>{for(const g of f.querySelectorAll('.gfield')){if(ks.some(k=>g.textContent.includes(k))){const i=g.querySelector('input:not([type=hidden]):not([type=radio]):not([type=checkbox]),textarea');if(i)return i}}return null};set(pick(['姓名']),D.name);set(f.querySelector('input[type=tel]')||pick(['手機','電話']),D.phone);set(f.querySelector('input[type=email]')||pick(['信箱']),D.email);let a=pick(['收件地址','地址','住址']);if(!a||a.value){a=[...f.querySelectorAll('input[type=text],textarea')].find(i=>!i.value&&i.offsetParent)}set(a,D.address);f.querySelectorAll('input[type=checkbox]').forEach(c=>{if(!c.checked)c.click()});const s=f.querySelector('input[type=submit],button[type=submit]
@exkuretrol
exkuretrol / ctex-fontset-windows-tc.def
Created January 26, 2023 17:35
適用於 windows ctex 的繁體中文字體庫。目前只有 XeLaTeX 可以編譯。
\ProvidesExplFile{ctex-fontset-windows-tc.def}{\ExplFileDate}{0.0.1}{\ExplFileDescription}
\ctex_fontset_case:nnn
{ }
{ }
{
\setCJKmainfont { MingLiU } [ BoldFont = Microsoft~JhengHei , ItalicFont = DFKai-SB ]
\setCJKsansfont { Microsoft~JhengHei } [ BoldFont = *~Bold ]
\setCJKmonofont { MingLiU~Regular }
\setCJKfamilyfont { ming } { MingLiU~Regular }
\setCJKfamilyfont { zhhei } { Microsoft~JhengHei }
@exkuretrol
exkuretrol / ctex-fontset-macnew-tc.def
Created January 26, 2023 17:32
適用於 mac ctex 的繁體中文字體庫。目前只有 XeLaTeX 可以編譯。
\ProvidesExplFile{ctex-fontset-macnew-tc.def}{\ExplFileDate}{0.0.1}{\ExplFileDescription}
\ctex_fontset_case:nnnn
{ \ctex_fontset_error:n { mac } }
{ }
{ }
{
\setCJKmainfont { Songti~TC }
[
BoldFont = Songti~TC~Bold,
ItalicFont = Kaiti~TC,
@exkuretrol
exkuretrol / hugo-shortcode-gist.html
Created January 26, 2023 17:19
simple hugo gist shortcode.
<script
src={{ printf "https://gist.github.com/%s/%s.js" (.Get "author") (.Get "hash") }}
></script>
@exkuretrol
exkuretrol / hugo-shortcode-details.html
Created January 26, 2023 17:07
Creates a details HTML element. You can pass your title to summary element to setup `title` argument.
{{ $open := .Get "open" | default "false" }}
{{ $markdownify := .Get "markdownify" | default "true" }}
<details
{{ if eq $open "true"}}
open
{{ end }}
>
<summary>
{{ i18n "click_to_open" | default "Click to Open" }}
@exkuretrol
exkuretrol / hugo-shortcode-table.html
Last active January 26, 2023 16:44
A hugo shortcode table, have 3 optional arguments, id, class and title.
{{ $htmlTable := .Inner | markdownify }}
{{ $label := i18n "table_label" | default "Table" }}
{{ $tag := "<table>" }}
{{ $newTag := "<table" }}
{{ with .Get "id" }}
{{ $newTag = printf "<table id='%s'" . }}
{{ end }}
{{ with .Get "class" }}