Skip to content

Instantly share code, notes, and snippets.

View kccheung's full-sized avatar
🎯
Focusing

David C kccheung

🎯
Focusing
  • Hong Kong SAR China
View GitHub Profile
@kccheung
kccheung / autossh-jump-rtunnel.service
Created October 25, 2019 04:40 — forked from ntrepid8/autossh-jump-rtunnel.service
AutoSSH reverse tunnel service config for systemd
[Unit]
Description=AutoSSH reverse tunnel service for jump.you.io 100022 -> 22
After=network.target
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -o "ExitOnForwardFailure=yes" -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -NR 10022:127.0.0.1:22 user@jump.you.io -i /home/root/.ssh/id_rsa
[Install]
WantedBy=multi-user.target
@kccheung
kccheung / bitmex-liquidation-calculator.py
Created April 11, 2023 09:08 — forked from highfestiva/bitmex-liquidation-calculator.py
cli bitmex liquidation calculation formula, minimal implementation
#!/usr/bin/env python3
import argparse
from math import ceil, floor
sign = lambda amt: -1 if amt<0 else (1 if amt>0 else 0)
class dobj: