Skip to content

Instantly share code, notes, and snippets.

@zorchp
zorchp / run-in-vim.vim
Created August 1, 2024 09:26
one key to run in vim9
" use quick fix window to run
" use AsyncRun plugin
"for asyncRun
" open quickfix window auto,height
let g:asyncrun_open = 9
" bell when task done.
let g:asyncrun_bell = 1
@zorchp
zorchp / .latexmkrc
Last active December 1, 2023 08:29
latexmk conf for nvim and vimtex on mac
#
# General
#
# Needed for the dot2texi package which invokes GraphViz.
$latex = 'latex --shell-escape';
$xelatex = "xelatex -synctex=1 -no-pdf -interaction=nonstopmode --shell-escape %O %S";
$pdf_mode = 5;
$recorder = 1;
@zorchp
zorchp / macos-global.gitignore
Last active November 19, 2023 14:07
.gitignore file for MacOS
# ~/.gitignore_global
# Symlinked into ~/ as .gitignore
# written in ~/.gitconfig
# [core]
# excludesfile = /Users/zorch/.gitignore_global
# Compiled source
*.dll
*.exe
@zorchp
zorchp / run-in-nvim.lua
Last active November 19, 2023 15:23
one key to compile and run some code on nvim with lua
local function CodeRunner()
--[===[========================== Global ===========================]===]
vim.api.nvim_create_autocmd({ "InsertLeave" }, {
callback = function()
vim.fn.execute("silent! write")
-- vim.notify("Autosaved!", vim.log.levels.INFO, {})
end,
})
-- for generate doc with neogen
@zorchp
zorchp / sogou-trans.py
Last active July 9, 2024 08:38
command-line tool for call sogou translator with pure post request
#!/opt/homebrew/Caskroom/miniforge/base/envs/py3x/bin/python3
"""
ref to https://blog.csdn.net/m0_53342945/article/details/130240344
1. get cookies contains FQV
2. post with FQV
3. parse result
"""
import os
@zorchp
zorchp / tiny.vimrc
Last active July 18, 2024 11:56
My tiny vimrc config for base usage.
" syntax highlight
syntax on
" show line number and relative number
set number
set relativenumber
" indent when newline
set smartindent
#!/usr/bin/env bash
if [ $# -ne 1 ]; then
echo "USAGE: $0 disk"
echo " e.g.: $0 Archlinux.qcow2"
exit 1
fi
if [ ! -f $1 ]; then
echo "could not open $1 : no such file"
@zorchp
zorchp / get-wechat-img.py
Last active October 8, 2023 06:03
get WeChat Public Platform title page image by Python
import re
import sys
import requests
def main():
argv = sys.argv
n = len(argv)
if n != 2:
@zorchp
zorchp / nvim-one-key-to-run.lua
Created October 7, 2023 13:44
one file compile on nvim by using one key, such as `F7` and `F8`.
local function CodeRunner()
--[===[========================== Global ===========================]===]
vim.api.nvim_create_autocmd({ "InsertLeave" }, {
callback = function()
vim.fn.execute("silent! write")
-- vim.notify("Autosaved!", vim.log.levels.INFO, {})
end,
})
--[===[========================== Static ===========================]===]
@zorchp
zorchp / wrap-ghidra-into-MacOS-app-bundle.py
Last active August 13, 2025 09:10
A worked way to bundle ghidra installed from homebrew to MacOS `.app` format.
#!/opt/homebrew/bin/python3
import os
import re
import subprocess as sp # for get command return value(stdout)
base_path = "/Applications"
app_name = "Ghidra"
exec_file = "ghidraRun"