This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = '**' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
".aaa", | |
".aarp", | |
".abarth", | |
".abb", | |
".abbott", | |
".abbvie", | |
".abc", | |
".abogado", | |
".abudhabi", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# coding: utf-8 | |
""" | |
Author : weaming | |
Created Time : 2019-04-24 12:41:48 | |
""" | |
import subprocess | |
import sys | |
import os |