Skip to content

Instantly share code, notes, and snippets.

View kuuote's full-sized avatar
🙃
I may be slow to respond.

kuuote

🙃
I may be slow to respond.
View GitHub Profile
@kuuote
kuuote / trilambda.scm
Created November 15, 2020 08:00
アイコンの素
(use data.random)
(use gauche.generator)
(use srfi-1)
(use util.match)
; DEBUG {{{
(define (display-line obj . port)
(let ((port (if (null? port) (current-output-port) port)))
(display obj port)
@kuuote
kuuote / gist:ae78ac5a3de14a938441cc165e9a9351
Created November 17, 2020 11:54
HTML側のインデントを抜き去れるinput
<script>
let indent = 0;
function redraw() {
const dom = document.querySelector('span');
dom.innerHTML = ' '.repeat(indent);
}
function handle() {
const dom = document.querySelector('input');
if(dom.selectionStart === 0) {
let s:maps = {}
function! HyperMap(from, to) abort
let key = a:from[-1:]
let prefix = a:from[:-2]
let map = get(s:maps, key, {})
let s:maps[key] = map
let map[prefix] = {'mapto': a:to, 'eval': v:false}
execute 'inoremap' '<expr>' key 'HyperResolve("' .. key .. '")'
@kuuote
kuuote / injector.ts
Last active April 30, 2021 00:48
Deno cache injector
import { createHash } from "https://deno.land/[email protected]/hash/mod.ts";
import { ensureDirSync } from "https://deno.land/[email protected]/fs/ensure_dir.ts";
import { walkSync } from "https://deno.land/[email protected]/fs/walk.ts";
/*
* Deno cache injector
* cache algorithm is referenced from Deno source
* https://github.com/denoland/deno/blob/main/cli/disk_cache.rs
* https://github.com/denoland/deno/blob/main/cli/deno_dir.rs
*
@kuuote
kuuote / shutdown.py
Created June 29, 2021 14:21
Windows絶対終わらせるマン(動くか不明)
import subprocess
from ctypes import *
subprocess.call(['sync','c'])
p = byref(c_byte())
rt = windll.ntdll.RtlAdjustPrivilege(19, True, False, p)
print(windll.ntdll.NtShutdownSystem(2))
@kuuote
kuuote / scroll_changed.vim
Created June 30, 2021 11:16
SafeStateを使ったScrollChangedもどき
function! s:test() abort
let oldline = get(b:, 'test', -1)
let curline = line('w0')
if oldline != curline
echomsg curline
let b:test = curline
endif
endfunction
augroup mytest
@kuuote
kuuote / lol.ts
Created July 1, 2021 16:10
lolcat imitation for deno
import { BufReader } from "https://deno.land/[email protected]/io/bufio.ts";
const stdin = BufReader.create(Deno.stdin);
const decoder = new TextDecoder("utf-8", {fatal: true});
const encoder = new TextEncoder();
const colors = [
[128, 255, 128],
[128, 128, 255],
@kuuote
kuuote / .fonts.conf
Created July 2, 2021 14:07
XMLつらいでござる〜
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- monospace -->
<match target="pattern">
<test qual="any" name="family"><string>monospace</string></test>
<edit name="family" mode="prepend" binding="same"><string>Noto Sans Mono</string></edit>
<edit name="family" mode="append" binding="same"><string>Noto Sans Mono CJK JP</string></edit>
</match>
<!-- sans-serif -->
@kuuote
kuuote / kana.vim
Created July 12, 2021 14:04
Vimでかな入力するやつ
function! kana#init() abort
let s:state = {}
let s:state.preedit = ""
let s:state.preedit_next = ""
let s:state.kakutei = v:false
let s:state.feed = ""
let s:table = json_decode(join(readfile("table.json"), ""))
call kana#map()
endfunction
@kuuote
kuuote / build
Last active July 19, 2021 13:25
denopsでGoのwasm読めるぞ
#!/bin/bash -u
go mod init hoge
GOOS=js GOARCH=wasm go build -v -o main.wasm