Skip to content

Instantly share code, notes, and snippets.

View weaming's full-sized avatar
🦀
Rustacean

Garden Yuen weaming

🦀
Rustacean
  • Shenzhen, China
View GitHub Profile
import arrow
from datetime import datetime
def unify_date(text: str):
text = text.strip().lower()
if text.startswith('circa'):
text = text[len('circa') :].strip()
try:
return arrow.get(text).date()
"""
https://redis.io/commands
var xs = []; $('.command').each(function(i,x){xs.push($(x).text().trim())}); console.log(JSON.stringify(xs))
save output as x.json
"""
import json
data = json.load(open('x.json'))
print(len(data))
#!/bin/bash
# Author : weaming
# Mail : garden.yuen@gmail.com
# Created : 2019-10-23 14:18:48
# https://blog.cloudflare.com/experiment-with-http-3-using-nginx-and-quiche/
# https://github.com/cloudflare/quiche/tree/master/extras/nginx#list-of-configuration-directives
# https://tools.ietf.org/html/rfc7838#section-3
# https://blog.cloudflare.com/http3-the-past-present-and-future/
# '/Applications/Google Chrome Canary.app' --enable-quic --quic-version=h3-23
# inspired by https://github.com/junegunn/fzf/issues/868
function __fzf_ls_files
git ls-tree -r --name-only HEAD 2>/dev/null; or fd --type f --hidden --follow --exclude .git
end
function __fzf_grep_last
set -l cmd (commandline)
# default complete all, and compatible with fzf `**<TAB>`
if str_endswith "$cmd" ' '; or test $cmd = '**'
#!/usr/bin/env node
// npm install -g puppeteer
// export NODE_PATH=$HOME/npm/lib/node_modules:$NODE_PATH
// http://screensiz.es/monitor
// https://pptr.dev/#?product=Puppeteer&version=v1.19.0&show=api-pagescreenshotoptions
// https://pptr.dev/#?product=Puppeteer&version=v1.19.0&show=api-pagesetcookiecookies
// https://github.com/GoogleChrome/puppeteer/issues/1062
// https://github.com/GoogleChrome/puppeteer/issues/669
("use strict");
import re
from pypinyin import pinyin, Style
def _recursive(a_list, b_list=None):
# a: [x] or x
if not isinstance(a_list, (list, tuple)):
a_list = [a_list]
# b: [x] or None
/* tweak Microsoft Teams Web client style */
/* weaming */
.teams-title,
.icons-appbar-download, .app-bar-text,
#app-bar-help-button, #discover-apps-button,
#ts-waffle-button
{
display: none;
}
[
".aaa",
".aarp",
".abarth",
".abb",
".abbott",
".abbvie",
".abc",
".abogado",
".abudhabi",
# vim: filetype=sh
# git
alias gconf='vi .git/config'
alias gamend='git commit --amend'
alias gamendy='git commit --amend --no-edit'
alias gback='git reset --hard HEAD~'
alias gl='git lg'
function greset() {
git reset --hard "${1:-HEAD}"
#!/usr/bin/env python3
# coding: utf-8
"""
Author : weaming
Created Time : 2019-04-24 12:41:48
"""
import subprocess
import sys
import os