Skip to content

Instantly share code, notes, and snippets.

View willwangcc's full-sized avatar
⚙️
workflow

Will willwangcc

⚙️
workflow
View GitHub Profile
@willwangcc
willwangcc / tmux.conf
Created February 20, 2020 06:02
tmux configuration from D. `~/.tmux.conf`
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
@willwangcc
willwangcc / colored_tags.css
Last active October 3, 2019 17:34
Stylish colored tags for workflowy
/*
- CHANGE UP THE TITLE (TAG NAME) & BACKGROUND COLOR
- FOR DIFFERENT COLORS:
(1) You can use the 147 CSS colors: http://www.colors.commutercreative.com/grid/
(2) ... or you can use hexidecimal color codes: http://html-color-codes.info/
https://gist.github.com/willwang-x/07eb654ff01f92d705ce9ef06356f69f
*/
[title~="@meeting"] {
@willwangcc
willwangcc / batch_book.py
Created June 2, 2019 17:30
files (.txt) to formatted string for latex
import os
path = "/Users/wangzhixiang/Developer/github/all-about-will-wang/days"
files = []
for filename in os.listdir(path):
files.append(filename)
files.sort()
int main(int argc, char* argv[])
{
int i = 0;
int arr[3] = {0};
for(i = 0; i<=3; i++){
arr[i] = 0;
printf("hello world\n");
}
return 0;
}
@willwangcc
willwangcc / src2md.py
Created December 14, 2018 00:27
#tool #小工具 #学英语
"""
src -> markdown
"""
script_path = "/Users/wangzhixiang/Desktop/Modern.Family.S09E04.srt"
name = script_path.split("/")[-1].strip(".srt")
print(name)
with open(script_path, encoding='utf-8') as f:
read_data = f.read()
@willwangcc
willwangcc / translate_demo_for_baidu_api.py
Created November 29, 2018 01:52
#python #小工具 #translate
#python 3.6
"""
Reference:
本文代码:https://blog.csdn.net/mr_guo_lei/article/details/78617669
百度官网:http://api.fanyi.baidu.com/api/trans/product/index
批量处理实例:https://juejin.im/entry/5bf2cebcf265da6151145aca
"""
@willwangcc
willwangcc / 20-useful-regular-expression.md
Last active October 31, 2018 23:35
#re 20个常用的正则表达式
  1. 校验密码强度

密码的强度必须是包含大小写字母和数字的组合,不能使用特殊字符,长度在8-10之间。

^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$
  1. 校验中文
# Time: O(N^3)
# where n is the number of nodes in the graph.
# There are O(N^2) states, and each state has an outdegree of N, as there are at most N different moves.
# Space: O(N^2)
class Solution:
def catMouseGame(self, graph):
"""
:type graph: List[List[int]]
:rtype: int
# Time: O(n^3) where n is the number of nodes in the graph. There are O(N^2) states, and each state has an outdegree of NN, as there are at most NN different moves.
# Space: O(n^2)
class Solution:
def catMouseGame(self, graph):
"""
:type graph: List[List[int]]
:rtype: int
"""
self.graph = graph
# 188. Best Time to Buy and Sell Stock IV
# Time: O(kn**2) where n == len(price)
# Space: O(nk)
# Time Limit Exceeded
# dp[i][j] = max(dp[i][j-1], (prices[j] - prices[m]) + dp[i-1][m]) m = 0,..,j
class Solution(object):
def maxProfit(self, k, prices):
"""