Skip to content

Instantly share code, notes, and snippets.

View kawarimidoll's full-sized avatar
🦕
#Deno

カワリミ人形 kawarimidoll

🦕
#Deno
View GitHub Profile
@kawarimidoll
kawarimidoll / be-vim-by-your-ears.md
Last active November 14, 2023 02:28
耳元にVimを
@kawarimidoll
kawarimidoll / sample-private.md
Created October 29, 2023 02:48
sample private

sample file

  1. create secret gist
  2. copy path
  3. change to public gist
  4. is path changed?
@kawarimidoll
kawarimidoll / yoji.txt
Last active July 12, 2023 11:50
四字熟語リスト
一上一下
一世一代
一世一元
一世一度
一世之傑
一世之雄
一世木鐸
一世風靡
一丘一壑
一丘之貉
@kawarimidoll
kawarimidoll / invite_history.ts
Last active July 9, 2023 11:45
Bluesky invite code history checker
// deno run --allow-net=bsky.social invite_history.ts
import AtprotoAPI from "npm:@atproto/api";
const { BskyAgent } = AtprotoAPI;
const service = "https://bsky.social";
const agent = new BskyAgent({ service });
const identifier = "YOUR_BLUESKY_IDENTIFIER"; // did or handle
const password = "YOUR_BLUESKY_PASSWORD"; // app-password is available
@kawarimidoll
kawarimidoll / setup-deno-json.ts
Last active June 10, 2023 01:51
setup deno_hooks from deno.json
// Usage:
// 1. Create a deno.json(c) file in the root of your project
// 2. Add hook scripts in "tasks" key like:
// {
// "tasks": {
// "pre-commit": "deno fmt",
// "pre-push": "deno test"
// },
// "hooks_dir": ".my-hooks" // optional, default: ".hooks"
// }
@kawarimidoll
kawarimidoll / fz-gist.sh
Last active November 28, 2022 13:37
edit or view gist by fzf and gh-cli
# define in your .bashrc or .zshrc
# fuzzy edit gist
fest() {
gh gist list "$@" | fzf --with-nth=-2,-4,-3,2..-5 | awk '{print $1}' \
| xargs --no-run-if-empty --open-tty gh gist edit
}
# view web gist
vest() {
@kawarimidoll
kawarimidoll / get_current_dot_chained_word.vim
Created September 11, 2022 06:50
get function call or property under current cursor position that chained by dots
let col = getcurpos('.')[2]
let line = getline('.')
let pre = substitute(line[:col-1], '^.*[^0-9A-Za-z_.]', '', '')
let post = substitute(line[col:], '[^0-9A-Za-z_.].*$', '', '')
echo pre .. post
@kawarimidoll
kawarimidoll / roman_kana_table.lua
Created September 11, 2022 05:13
generate romaji-kana table for japanese input
-- https://support.microsoft.com/ja-jp/topic/%E3%83%AD%E3%83%BC%E3%83%9E%E5%AD%97%E5%85%A5%E5%8A%9B%E3%81%AE%E3%81%A4%E3%81%A5%E3%82%8A%E4%B8%80%E8%A6%A7%E8%A1%A8%E3%82%92%E7%A2%BA%E8%AA%8D%E3%81%97%E3%81%A6%E3%81%BF%E3%82%88%E3%81%86-bcc0ad7e-2781-cc9a-e524-7de506d8fdae
local roman_kana_table = {
-- common symbols in japanese writings
['~'] = '~', [','] = '、', ['.'] = '。', ['/'] = '・',
['-'] = 'ー', ['['] = '「', [']'] = '」',
-- other full-space symbols
-- ['!']='!', ['"']='”', ['#']='#', ['$']='$', ['%']='%',
-- ['&']='&', [''']='’', ['(']='(', [')']=')', ['*']='*',
-- ['+']='+', [',']=',', ['-']='-', ['.']='.', ['/']='/',
@kawarimidoll
kawarimidoll / git-sw.sh
Created July 24, 2022 04:20
Smart git-switch using fzf
#!/bin/bash
# Save this file as `git-sw` in your $PATH and run `chmod +x git-sw`.
# Run `git sw -` to switch to last branch.
# Run `git sw` to select branch using fzf.
# Run `git sw branch-name` to pass query to fzf.
# If the argument is matched to existing branch, change to that immediately.
# Create new branch when query is not matched by `fzf --print-query | tail -1`.
# ref: https://github.com/junegunn/fzf/issues/1693#issuecomment-699642792
@kawarimidoll
kawarimidoll / three-characters-timestamp.ts
Created July 23, 2022 22:59
generate three characters timestamp that is sortable
export function threeCharactersTimestamp(date?: Date) {
if (!date) {
date = new Date();
}
const [h, m, s] = [date.getHours(), date.getMinutes(), date.getSeconds()];
// min & sec eatch 4 seconds
const ms = Math.floor((m * 60 + s) / 4);
const [m2, s2] = [Math.floor(ms / 30), ms % 30];