Skip to content

Instantly share code, notes, and snippets.

@uonr
uonr / vim-settings.json
Created January 28, 2024 20:39
VSCode Vim Settings
{
"vim.leader": " ",
"vim.useSystemClipboard": true,
"vim.incsearch": true,
"vim.hlsearch": true,
"vim.sneakUseIgnorecaseAndSmartcase": true,
"vim.easymotionMarkerForegroundColorOneChar": "#EA89FF",
"vim.visualModeKeyBindings": [
{
"before": ["<tab>"],
#!/usr/bin/env python3
import imghdr
import glob
from sys import argv
from pathlib import Path
pattern = '/Users/uonr/Pictures/*';
print(pattern)
for filepath in [Path(p) for p in glob.glob(pattern)]:
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "mikan";
home.homeDirectory = "/Users/mikan";
home.sessionVariables.EDITOR = "hx";
# This value determines the Home Manager release that your

Keybase proof

I hereby claim:

  • I am uonr on github.
  • I am coppa (https://keybase.io/coppa) on keybase.
  • I have a public key ASDWGw_AEgGCC1Kr5AyDITcmgu-tAO9lZmP6DGJrEepPKQo

To claim this, I am signing this object:

@uonr
uonr / linux.sh
Created July 13, 2019 16:28
系统命令
# 权限设置
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
@uonr
uonr / MySQL.sql
Created July 13, 2019 10:17
SQL 片段
CREATE DATABASE mydb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
import Text.ParserCombinators.Parsec
data Expr = Str String | Number Int | Add Expr Expr
deriving Show
expr :: Parser Expr
expr = do
left <- try str <|> number -- nonterminals and terminals that does not start with `expr`
let rest = do
char '+'
@uonr
uonr / useAutoHeight.tsx
Last active April 12, 2019 19:14
React Hooks for Textarea Auto Height
const useAutoHeight = (text: string, inputRef: React.RefObject<HTMLTextAreaElement>) => {
const threshold = 4;
const additionPx = 2;
const prevText = useRef(text);
useEffect(() => {
const input = inputRef.current;
if (input) {
const isContentReduce = text.length < prevText.current.length;
let oldHeightStyle = null;
@uonr
uonr / gpg-key.asc
Last active April 4, 2020 17:18
Fingerprint 6F54 BDFC 0402 52E3 2209  2CA6 54FA F1CB 549D 56E9
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBF03W24BEADReBZmEgGnFlBQcemeziBnrMkWplr/iBVIUqIzRB0Ls5DK87X2
8aXW17vGsgPns//bdjhBwlQrOvUXtwE5LcqZ38vSjwvnA4UYGEkgevoeWUwOe2bW
zN15g7FjYAQXUZn+ia4BBT6vXq4SNwgojSfQZJ7OCWZwrYtXANp4pHKFxp8DFj7S
nqePF7hzuhna3RHcuEoDOp/t+AUezF1AGo/w/519XUcdWc4wjuh+oeuDmaSrpyO9
QaLydVRskojkuvKCDn8XzF1XQb+rPgyKQJLTXpeUhgH7/ODUpmiOlXjVrLNaIxrJ
zU3MjjDMhCIMc4GTcAZwesKFBy44+f5Vnq0/Umy72Xoao6fyY84d7bvDeBOm4B1E
NebzWA/w1CjEKYws6Hi9hsGlw+cYfMNn99Ssh1Zcy6M5NLPl0NMTWLl2S0A6dv0O
V9z+KQcoLcdu0CsD/tYkNKLtM/jbutGnC4VOaS4cuhXQZ3JL1vR2tRKLDgDc1ZvK
@uonr
uonr / type_query.ts
Last active October 25, 2018 14:59
return a type by pass this type‘s name
export type Name = { name: string }
export type Id = { id: number }
type Get<T extends string> =
T extends "Name" ? Name :
T extends "Id" ? Id :
never
function get<T extends string>(x: T): Get<T>;