language | line | count | avg | repo | query |
---|---|---|---|---|---|
Go | 1580380 | 690 | 2290 | https://github.com/golang/go.git | rg -c -t go '^type.+interface {' | cut -d: -f2 | awk '{sum += $1}; END {print sum}' |
Java | 5370734 | 7269 | 739 | https://github.com/openjdk/jdk.git | rg -c -t java 'interface .+{$' |
Rust | 895020 | 3495 | 256 | https://github.com/rust-lang/rust | rg -c -t rust 'trait .+{$' |
TypeScript | 1461415 | 7376 | 198 | https://github.com/microsoft/TypeScript.git | rg -c -t ts 'interface .+{$' |
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
# var a = new Array() | |
# document.querySelectorAll('.text-ellipsis').forEach(items=>{a.push(items.title)}) | |
# console.log(a.join('\n')) | |
# git clone https://github.com/intellij-rust/intellij-rust --depth=1 || true | |
# ... | |
# ls -1 | xargs -I{} scc -f json {} | jq '.[] | select(.Name == "Kotlin") | .Code' | pbcopy | |
# ls -1 | pbcopy |
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
# CPS + 高阶函数可以将递归改写成尾调用,使用Trampoline即可避免爆栈 | |
def cpsF(x,count): | |
if x == 0: | |
count(1) | |
else: | |
cpsF(x-1,lambda y:count(x*y)) | |
cpsF(257,print) |
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
一个纯函数,输出只取决于输入 | |
使用最简单的情况举例,一个递归函数只存在一个递归调用 | |
该递归调用讲函数分成三个部分, | |
1. 递归基 + 准备部分 | |
2. 递归调用部分 | |
3. 递归调用之后的部分 | |
其中第一部分的 准备部分 可以影响递归调用的参数值 | |
第三可以使用递归返回的值(写的时候可以认为这个值来自未来,或者有些更简单的情况,明显能感受到它就是从后往前在处理) |
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
# Redis configuration file example. | |
# | |
# Note that in order to read the configuration file, Redis must be | |
# started with the file path as first argument: | |
# 注意,为了读取配置文件,Redis必须以文件路径作为第一个参数启动。 | |
# | |
# ./redis-server /path/to/redis.conf | |
# Note on units: when memory size is needed, it is possible to specify |
macOS 10.15.7
env SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" CFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineT
ools/SDKs/MacOSX.sdk/usr/include" CPPFLAGS="-I/usr/local/opt/zlib/include" LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib" asdf install python 3.9.0
python-build 3.9.0 /Users/ficapy/.asdf/installs/python/3.9.0
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
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://hackernoon.com/currying-in-js-d9ddc64f162e | |
function curry1(fn) { | |
function nest(N, args) { | |
return (...xs) => { | |
if (N - xs.length === 0) { | |
return fn(...args, ...xs); | |
} | |
return nest(N - xs.length, [...args, ...xs]); | |
}; |
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 traverse(root): | |
stack, ret = [root], [] | |
while stack: | |
cur = stack.pop() | |
if isinstance(cur, Node): | |
# stack.extend([cur.right, cur.left, cur.val]) # <- 前序遍历 | |
# stack.extend([cur.right, cur.val, cur.left]) # <- 中序遍历 | |
stack.extend([cur.val, cur.right, cur.left]) # <- 后序遍历 | |
elif isinstance(cur, int): | |
ret.append(cur) |
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 cryptography.hazmat.primitives.ciphers import algorithms, modes, Cipher | |
from cryptography.hazmat.backends import default_backend | |
import binascii | |
# https://github.com/wangyiwy/oktools/blob/133bad6350/static/js/encrypt_des.js | |
# 参照这个前端网页的Crypto-JS加密结果 | |
# 3DES,ECB,无填充,无iv | |
# https://www.crypto101.io/ | |
# https://stackoverflow.com/questions/61717485/incorrect-decrypted-string-implemented-using-aes-ecb-nopadding-and-base-64-with |
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 ( | |
"flag" | |
"fmt" | |
"github.com/gin-gonic/gin" | |
"net/http/httputil" | |
) | |
func CORS() gin.HandlerFunc { |