Skip to content

Instantly share code, notes, and snippets.

View tclh123's full-sized avatar
💭
Be an artist

Harry Lee tclh123

💭
Be an artist
View GitHub Profile
@tclh123
tclh123 / vpn.md
Created November 8, 2023 17:02 — forked from condorheroblog/vpn.md
@tclh123
tclh123 / gist:3455441d0d2340cccaf2f81e327a3dd2
Created March 17, 2021 09:11 — forked from tjackowiak/gist:5058743
Moving Graphite database
1. Stop Apache
sudo /etc/init.d/apache2 stop
2. Stop Carbon
sudo su www-data
cd /opt/graphite/
./bin/carbon-cache.py stop
3. Move whisper directory to new location
@tclh123
tclh123 / README.md
Created November 10, 2020 09:22 — forked from bobrik/README.md
CFS hiccups
什么是交易策略?
交易策略是一系列规则的集合,包括进场和出场的条件,资金管理和风险控制等。策略有简单和复杂之分,简单的策略通常使用技术指标和价格行为,复杂的策略使用高阶数学和统计模型。通常情况下,我们会认为复杂的模型更优,但实证分析和学术研究表明,复杂的模型往往过度挖掘了历史数据,无法适应剧烈的市场变异,相反简单的模型在长期中更加稳定。
交易策略可划分为3个部分:指标(Indicator),信号(Signal)和规则(Rule)。
指标用于生成交易信号。计算指标的方法多种多样,可以是经济数据或估值指标(如PE和EBITDA),可以是技术指标(如MACD,RSI,MA),也可以是时间序列模型(ARIMA,GARCH)。技术指标在外汇交易中被广泛使用,它们是价格或成交量的函数,主要用于侦测趋势方向,衡量超买超卖状态,以及判断趋势反转。
价格和指标的相互作用形成信号。以均线穿越为例,当5日均线上穿10日均线时买入,当5日均线下穿10日均线时卖出。信号并不局限于买入和卖出,也包含筛子,主要作用是剔除噪音。在均线穿越中,交易员可以增加趋势筛子:只有当价格高于200日均线(上涨趋势),以及5日均线上穿10日均线才做多,如果价格低于200日均线,黄金交叉被视为虚假信号。著名的筛子有趋势筛子,时间筛子,成交量筛子和波动性筛子,它们是信号的重要组成部分。
@tclh123
tclh123 / iostream.rs
Created August 30, 2019 07:54 — forked from tamamu/iostream.rs
std::cout (C++) in Rust
use std::ops::Shl;
struct Rsout;
struct Endl;
impl<'a> Shl<&'a str> for Rsout {
type Output = Rsout;
fn shl(self, _rhs: &'a str) -> Rsout {
print!("{}", _rhs);
@tclh123
tclh123 / postgres-cheatsheet.md
Created February 28, 2019 16:06 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@tclh123
tclh123 / git.bat
Created June 29, 2018 12:11 — forked from victor-perez/git.bat
Use WSL git inside VS Code from Windows 10 17046
@echo off
wsl wslpath -aw $(git %*) 2> nul
if not %errorlevel% == 0 (
wsl git %*
)
@echo on
@tclh123
tclh123 / gist:12bf790cc1a0e7353da110c8f68b2ad4
Created July 26, 2017 09:08 — forked from kbarber/gist:6456420
Renewing a Puppet CA cert
Renew Puppet CA cert.
Not the perfect idea, but should alleviate the need to resign every cert.
What you need from existing puppet ssl directory:
ca/ca_crt.pem
ca/ca_key.pem
Create an openssl.cnf:
[ca]
@tclh123
tclh123 / cryptography_3des_demo.py
Created December 14, 2016 07:53 — forked from mrluanma/cryptography_3des_demo.py
Python 用 PyCrypto, M2Crypto, ncrypt, cryptography 3DES ECB mode 加密解密 demo。
import os
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.backends import default_backend
backend = default_backend()
key = os.urandom(16)
text = b'Hello, there!'
padder = padding.PKCS7(algorithms.TripleDES.block_size).padder()

KVM OSX Guest 10.11 (El Capitan) with Clover

  • Some notes about this approach:
    • An OSX Installer USB drive for Install OS X El Capitan is created
    • Clover is then installed on the USB drive
    • Clover Configurator is then run on the USB drive
    • The USB drive contents are copied to the VM host
    • VNC is used to connect to the guest UI
  • The qxl virtual video device is used (part of the standard kvm qemu install)