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 / flake.nix
Created November 8, 2024 16:51
home-managerでkuusayを導入するための最高の設定
{
description = "A very basic flake";
inputs = {
home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
kuusay.inputs.nixpkgs.follows = "nixpkgs";
kuusay.url = "github:times-yasunori/kuusay";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
@kuuote
kuuote / reading_vimrc.vim
Created October 19, 2024 14:29
読書会util
let s:contain_lines = v:false
function! s:open() abort range
GinCd
let file = expand('%:.')
if a:firstline == a:lastline
let line = printf('L%d', a:firstline)
else
let line = printf('L%d+%d', a:firstline, a:lastline - a:firstline)
endif
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{
config,
lib,
pkgs,
...
}:
@kuuote
kuuote / random_first.ts
Created January 8, 2024 04:22
fuzzyfinderのsorterを魔改造して、プロンプトがない時の表示順序をランダム化するとかも便利か……? by atusy
import {
BaseFilter,
FilterArguments,
} from "https://deno.land/x/[email protected]/base/filter.ts";
import { Context, DduItem } from "https://deno.land/x/[email protected]/types.ts";
type Never = Record<PropertyKey, never>;
export class Filter extends BaseFilter<Never> {
#cache = new WeakMap<Context, Map<string, number>>();
@kuuote
kuuote / json.vim
Created December 18, 2023 10:58
parses subset of ECMA-404
" ws以外の全ての関数は[result, newpos]を返す
function! s:object(in, pos) abort
let p = s:ws(a:in, a:pos + 1)
if a:in[p] == 125 " }
return [{}, p + 1]
endif
let acc = {}
while v:true
let [r, p] = s:member(a:in, p)
@kuuote
kuuote / slurp_window.ts
Created December 9, 2023 10:50
Denoからslurpとswaymsg叩いてクリックしたウィンドウのサイズを取得するやつ
import * as u from "https://deno.land/x/[email protected]/mod.ts";
import { is } from "https://deno.land/x/[email protected]/mod.ts";
type Point = {
x: number;
y: number;
};
type Rect = Point & {
width: number;
@kuuote
kuuote / clip.sh
Created February 24, 2023 11:08
i3でスッとVimを出して保存した結果をクリップボードにコピペするやつ
#!/bin/bash -u
touch /tmp/clip
wezterm start --class Floaterm nvim /tmp/clip || exit 1 # Vimが正しく終了しなかった時はコピーしない
# head -c -1は末尾の改行を削ぎ落とすやつ
head -c -1 /tmp/clip | xclip -selection clipboard
notify-send -t 1000 copied
@kuuote
kuuote / boot.sh
Created January 6, 2023 18:32
爆速コンテナ
#!/bin/bash -u
if [[ $(id -u) != 0 ]]; then
exec sudo $0 $@
fi
base=/tmp/archbase
root=/tmp/archroot
mkdir -p /tmp/gen
function! BF(fxxk) abort
let mem = 0z00
for i in range(15)
let mem = mem + mem
endfor
let ip = 0
let dp = 0
let out = []
while ip < len(a:fxxk)
let c = a:fxxk[ip]
@kuuote
kuuote / colorize.vim
Created September 6, 2021 16:25
Imitation of 3bmd's colorize
" 括弧を収集
function! s:collect() abort
let view = winsaveview()
let pairs = []
call cursor([1, 1])
if search('(\|)', 'cW')
call add(pairs, [getline('.')[col('.')-1], [line('.'), col('.')]])
endif
while search('(\|)', 'W')