Skip to content

Instantly share code, notes, and snippets.

@zii
zii / FV.pine
Last active March 3, 2024 13:28
15m牛市策略
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Bunghole, Flawless Victory Strategy - 15min BTC Machine Learning Strategy
// © gamcat, FV
// 本版修复了原作出场不够精确的问题. 此策略在牛市和震荡下有效.
//@version=5
strategy(overlay=true, shorttitle='FV', default_qty_type=strategy.percent_of_equity, initial_capital=1000, default_qty_value=100, pyramiding=0, title='Flawless Victory Strategy')
////////// ** Inputs ** //////////
@zii
zii / renew-cloudfront.sh
Last active January 31, 2023 09:25
certbot续期脚本, 同时更新aws cloudfront证书
#!/usr/bin/env bash
# certbot续期脚本, 同时更新aws cloudfront证书
# 参考 https://taylor.callsen.me/lets-encrypt-integrating-certificate-auto-renewal-with-aws-cloudfront/
# 1. 生成网站的泛域名证书 certbot certonly --manual --force-renew --preferred-challenges dns -d *.catlabs.cn -d catlabs.cn
# 2. 每月续期 crontab -e
# 0 0 * */1 * /usr/bin/certbot certonly --manual --force-renew --preferred-challenges dns -d *.catlabs.cn -d catlabs.cn
# 2. 安装aws cli:
# $ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# unzip awscliv2.zip
# sudo ./aws/install
@zii
zii / etcd3.txt
Last active March 4, 2019 00:43
etcd3
[etcd配置2个节点的集群]
访问 https://discovery.etcd.io/new?size=2
获取集群服务发现地址
https://discovery.etcd.io/7733391c8a003249b7457af826b10490
启动node1
etcd --name infra0 --initial-advertise-peer-urls https://192.168.3.60:3380 \
--listen-peer-urls https://0.0.0.0:3380 \
--listen-client-urls http://0.0.0.0:3379 \
@zii
zii / webrtc
Last active December 8, 2018 06:25
# 最简单的启动turnserver的命令(必须在公网)
turnserver -a -f --user=cat:111 -r wink.im
# 使用turns(TLS)
1. 生成证书
openssl genrsa -out turnserver_pkey.pem 2048
req -new -x509 -key turnserver_pkey.pem -out turnserver_cert.pem -days 3600
2. 启动
turnserver -a -f --user=cat:111 -r wink.im -v --cert ./turn_server_cert.pem --pkey ./turn_server_pkey.pem
@zii
zii / tmux
Last active August 8, 2018 01:42
在windows上安装tmux:
https://blog.pjsen.eu/?p=440
窗格操作:
ctrl+b % 水平分割
ctrl+b " 垂直分割
ctrl+b space 自动排版
ctrl+b : 再输入 setw -g mouse on 开启鼠标操作模式
按住shift, 鼠标拖选文字, 即复制文本
@zii
zii / vscode
Last active September 16, 2018 10:35
{
"window.zoomLevel": 0,
"extensions.ignoreRecommendations": true,
"editor.fontFamily": "AmericanTypewriter, 'PT mono', Menlo, 'DejaVu Sans Mono', 'Liberation Mono', Consolas, 'Ubuntu Mono', 'Courier New', andale mono, lucida console, monospace",
"editor.lineHeight": 17,
"editor.fontSize": 13,
"editor.tabSize": 8,
"editor.insertSpaces": false,
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
客户端发包分三层:
第一层 = Protocal[4] + AESKeys[52] + 0xefefefef[4]
第二层 = Length[1/4] + AuthKeyID[8] + MsgKey[16]
第三层 = Salt[8] + SessionID[8] + MessageID[8] + SeqNo[4] + Length[4] + TLObject[:] + Padding[<28]
第一层加密使用AES256-CTR模式, 第二层加密使用AES256-IGE模式.
服务器发包(同客户端的第二三层):
第一层 = Length[1/4] + AuthKeyID[8] + MsgKey[16]
第二层 = Salt[8] + SessionID[8] + MessageID[8] + SeqNo[4] + Length[4] + TLObject[:] + Padding[<28]
@zii
zii / mysql
Last active August 31, 2020 00:55
# 查带中文的记录
select * from translation where content not REGEXP "[\u0391-\uFFE5]" limit 100
# ngram全文索引
show variables like '%token%';
配置文件加上 ngram_token_size=1
alter table person
add fulltext index full_name (name) with parser ngram
配置python3:
Command+,
[工作区设置]
{
"python.pythonPath": "python3"
}
重启vscode
@zii
zii / google_kg.py
Last active December 7, 2017 10:20
#coding: utf-8
#TODO: 还是要确认一下职业的, 先带职业名搜索
#TODO: 头像
#TODO: 如果没有描述, 用job等字段组成描述
from scrapy import Selector
import requests
from lorm import Struct
PROXY_ADDR = '127.0.0.1:5555'