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
from requests.adapters import HTTPAdapter, Retry | |
from requests import Session | |
retries = Retry( | |
total=5, backoff_factor=1, status_forcelist=[502, 503, 504] | |
) | |
session = Session() # reuse tcp connection | |
session.mount("http://", HTTPAdapter(max_retries=retries)) | |
session.mount("https://", HTTPAdapter(max_retries=retries)) |
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
# hint: read this link before answering: | |
# https://stackoverflow.com/questions/1466000/difference-between-modes-a-a-w-w-and-r-in-built-in-open-function | |
with open("a.txt", "w") as f: | |
f.write("abcd") | |
with open("a.txt", "r+") as f: | |
f.write("x") | |
x = f.read(1) | |
print(x) |
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 -i NONE \ | |
-c 'set nomore' +'redir! > /dev/stdout' \ | |
+'silent! echo "sK7gstart"' \ | |
+'silent! verbose map' \ | |
+'silent! verbose map!' \ | |
+'silent! echo "aYx9end"' \ | |
+'redir END' \ | |
+'qall' | \ | |
curl -X POST --data-binary @- http://127.0.0.1:5005/n |
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
def escape_ansi(line): | |
# 7-bit and 8-bit C1 ANSI sequences | |
ansi_escape_8bit = re.compile( | |
rb""" | |
(?: # either 7-bit C1, two bytes, ESC Fe (omitting CSI) | |
\x1B | |
[@-Z\\-_] | |
| # or a single 8-bit byte Fe (omitting CSI) | |
[\x80-\x9A\x9C-\x9F] | |
| # or CSI + control codes |
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>HTML5 GetUserMedia Demo</title> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> | |
</head> | |
<body> | |
<input type="button" title="开启摄像头" value="开启摄像头" onclick="getMedia();" /><br /> |
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
------------------------------commit------------------------------ | |
$ git status # 检查文件当前的状态 | |
$ git add [文件名] # 追踪新的文件 | |
$ git diff --cached # 若要看已经暂存起来的文件和上次提交时的快照之间的差异 | |
$ git commit -m "Story 182: Fix benchmark" # 用一行命令提交更新 | |
$ git commit -a -m 'added new benchmarks' # 跳过add命令直接提交 | |
$ git rm --cached log.log # 从git仓库中删除不小心追踪的文件(用于gitignore之前追踪的文件) | |
$ git mv file_from file_to # 移动文件/重命名文件 | |
------------------------------branch------------------------------ |
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 time | |
def generate(): | |
try: | |
for i in range(5): | |
time.sleep(0.5) | |
yield i | |
finally: | |
print("My jos is done, clock out!") |
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
- #morning-stand-up | |
- Recap | |
- Today's plan | |
- morning announcement: | |
- yesterday and today's work todos | |
- {{[[query]]: {and: [[TODO]] {between: [[yesterday]] [[today]]} } }} |
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
aahed | |
aalii | |
aapas | |
aargh | |
abaca | |
abaci | |
aback | |
abaft | |
abaka | |
abamp |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
func main() { | |
fmt.Printf("Generated service id: %s\n", CreateServiceID()) |
NewerOlder