Skip to content

Instantly share code, notes, and snippets.

youtube-dl -v --cookies /Users/ficapy/Downloads/oreilly/cookies.txt -o "Oreilly - %(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "https://learning.oreilly.com/videos/hands-on-systems-programming/9781838822132"  --add-metadata --write-sub --convert-subs srt --sleep-interval 15 --max-sleep-interval 30 | tee $(date +%Y%m%d-%h:%M).log
@ficapy
ficapy / full_screen.html
Created June 29, 2020 01:49
Full-Screen Layout using Flexbox http://bl.ocks.org/jfsiii/5380802
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Holy Grail</title>
<style>
/* some basic styles. nothing to do with flexbox */
header, footer,
nav, article, aside {
border: 1px solid black;
let a = []
function _add_empty(node, raw){
// 如果多个标签合并成一个,最低保证合并的时候左右存在空格
function inner(node){
let innertext = node.innerText
if (!innertext){
return
}
let content = innertext.trim()
@ficapy
ficapy / go_csv.go
Created September 16, 2020 03:21
Python: 60秒 Golang: 3.3秒 Rust: 2.6秒
package main
import (
"encoding/csv"
"github.com/mmcloughlin/geohash"
"github.com/suifengtec/gocoord"
"io"
"os"
)
@ficapy
ficapy / ignore_cors.go
Created December 22, 2020 09:32
用nc接收浏览器请求的时候有跨域OPTION请求无法跳过,写了个替代的小脚本
package main
import (
"flag"
"fmt"
"github.com/gin-gonic/gin"
"net/http/httputil"
)
func CORS() gin.HandlerFunc {
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
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)
// 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]);
};
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
@ficapy
ficapy / redis.conf
Created March 13, 2021 09:07
redis.conf 中文翻译 版本6.2.1
# 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