Skip to content

Instantly share code, notes, and snippets.

View towry's full-sized avatar
🎯
Focusing

Towry Wang towry

🎯
Focusing
View GitHub Profile
commit ee66f4d2aa9c5361f8d07ec700fba45cf2238bf9
Author: Towry <towry@users.noreply.github.com>
Date: Sun Jan 7 09:18:18 2024 +0800
change wilmode
diff --git a/lua/user/config/options.lua b/lua/user/config/options.lua
index 058e439..2700c0d 100644
--- a/lua/user/config/options.lua
+++ b/lua/user/config/options.lua
@towry
towry / wt.fish
Created December 8, 2023 06:18
quickly switch between git workspace folders.
# put this fish function in your fish config.
#
# usage:
# ~:> wt
# or
# ~:> wt path_or_branch_keyword
function wt
set worktree (git worktree list | awk '{print $1, $NF}' | awk -v home="$HOME" '{sub(home, "~"); print $1, $NF}' | fzf --exact --reverse -1 -0 --query=$argv[1] | awk '{print $1}')
if test -n "$worktree"
@towry
towry / doc.md
Last active September 12, 2023 09:19
cd /tmp
# wait treesitter#main setup
nvim --clean -u slow-ts.lua
# exit nvim
# edit test.vue file
nvim --clean -u slow-ts.lua test.vue

steps

@towry
towry / repro.lua
Last active July 16, 2023 03:00
`nvim -u init.lua` to reproduce some neovim plugin repo issue.
vim.g.mapleader = ' '
local root = vim.fn.fnamemodify('./.repro', ':p')
-- set stdpaths to use .repro
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end
-- bootstrap lazy
@towry
towry / color_mode.py
Last active February 26, 2023 06:04
macos auto dark mode with kitty+tmux+neovim. read order: install_dark_mode_notify.sh -> ke.bou.dark-mode-notify.plist -> dark_mode_changed.sh -> color_mode.py | YOU NEED TO CHANGE SOME PATH&VARIABLE to make this work.
#!/usr/bin/env python3
import os
import sys
import subprocess
# author: https://github.com/olimorris/dotfiles/blob/main/commands/color_mode.py
kitty_path = "~/.config/kitty"
# starship_path = "~/.config/starship"
This file has been truncated, but you can view the full file.
[{"tid":1,"pid":1,"args":{"n":2,"1":"getbufinfo"},"cat":"function","name":"vim.shared.call","ph":"X","ts":149.235,"dur":34.906},
{"tid":1,"pid":1,"args":{"n":2,"1":"getbufinfo"},"cat":"function","name":"vim.call","ph":"X","ts":143.483,"dur":42.05},
{"tid":1,"pid":1,"args":{"n":2,"1":"getbufinfo"},"cat":"function","name":"vim._editor.call","ph":"X","ts":136.537,"dur":50.048},
{"tid":1,"pid":1,"cat":"function","name":"bufferline.utils.get_buf_count","ph":"X","ts":125.179,"dur":62.234},
{"tid":1,"pid":1,"args":{"n":2,"1":"showtabline"},"cat":"function","name":"vim.api.nvim_get_option_value","ph":"X","ts":191.461,"dur":2.111},
{"tid":1,"pid":1,"cat":"function","name":"bufferline.config.get","ph":"X","ts":195.362,"dur":0.58199999999999},
{"tid":1,"pid":1,"cat":"function","name":"vim.api.nvim_list_bufs","ph":"X","ts":209.087,"dur":1.213},
{"tid":1,"pid":1,"args":{"1":"c"},"cat":"function","name":"vim.shared.is_callable","ph":"X","ts":238.177,"dur":2.956},
{"tid":1,"pid":1,"args":{"1":"c"},"cat":"function","name":"v
/* fonts
* ===============================*/
@import url('https://fonts.loli.net/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400;1,600;1,700&display=swap');
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont/style.css');
@font-face {
font-family: "Only Emoji";
src: local("Apple Color Emoji"), local("Android Emoji"), local("Segoe UI Emoji"), local("Segoe UI");
unicode-range: U+200D, U+2049, U+20E3, U+2117, U+2120, U+2122, U+2139, U+2194-2199, U+21A9, U+21AA, U+229C, U+231A, U+231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FE, U+24C2, U+25A1, U+25AA-25AD, U+25B6, U+25C0, U+25D0, U+25D1, U+25E7-25EA, U+25ED, U+25EE, U+25FB-25FE, U+2600-2605, U+260E, U+2611, U+2614, U+2615, U+2618, U+261D, U+2620, U+2622, U+2623, U+2626, U+262A, U+262E, U+262F, U+2638-263A, U+2640, U+2642, U+2648-2653, U+265F, U+2660, U+2663, U+2665, U+2666, U+2668, U+267B, U+267E, U+267F, U+2691-2697, U+2699, U+269B, U+269C, U+26A0, U+26A1, U+26A7, U+26AA, U+26AB, U+26B0, U+26B1, U+26BD, U+26BE, U+26C4,
/* Modify rendering of Logseq calculator:
- Overlay answers in calculator editor window;
- Disable line-wrapping in editor window (to preserve correspondence);
- Add feint ruling;
- Misc. cosmetic tweaks.
*/
:root {
--calculator-input-width: 68%;
@towry
towry / downloadWeappLinkPageData.js
Last active August 18, 2022 04:55
[油猴脚本] 下载小程序绑定的公众号数据.tampermonkey
// ==UserScript==
// @name DownloadWeappLinkPage
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 下载小程序绑定的公众号数据
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @author Towry Wang (github.com/towry)
// @match https://mp.weixin.qq.com/wxamp/basicprofile/relation?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=qq.com
// @grant GM_notification
@towry
towry / qiniu.spec.ts
Created October 30, 2020 07:38
qiniu tool, imageMogr2
import { imageMogr2 } from "../qiniu";
describe("imageMogr2", () => {
it("should work with single parameter", () => {
const url =
"https://dn-odum9helk.qbox.me/resource/gogopher.jpg?imageMogr2/thumbnail/!20p&a=2";
const addMoreArg = "/rotate/200/quality/200";
expect(imageMogr2(url, addMoreArg)).toBe(
"https://dn-odum9helk.qbox.me/resource/gogopher.jpg?a=2&imageMogr2/thumbnail/!20p" +