Skip to content

Instantly share code, notes, and snippets.

View dawncold's full-sized avatar
🎯
Focusing

Zhen Tian dawncold

🎯
Focusing
View GitHub Profile

DefaultKeyBinding.dict in your ~/Library/KeyBindings

{
  "\UF729"  = moveToBeginningOfParagraph:; // home
  "\UF72B"  = moveToEndOfParagraph:; // end
  "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
  "$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
  "^\UF729" = moveToBeginningOfDocument:; // ctrl-home
 "^\UF72B" = moveToEndOfDocument:; // ctrl-end
@dawncold
dawncold / ga.js
Last active April 23, 2021 15:21
ga and pendo install script explain
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
function installGA() {
@dawncold
dawncold / resources.yaml
Created May 12, 2021 23:33
k8s secret and cronjob
apiVersion: v1
kind: Secret
metadata:
name: app-secret
type: Opaque
stringData:
dbconnstr: this-is-db-connection-string-in-secret
username: admin
password: KuBeRnEtEs
---
@dawncold
dawncold / debug.py
Created June 22, 2021 00:16
How to debug Twisted TLS with wireshark
# 1. setup environment SSLKEYLOGFILE, value is a file path, I set it to /tmp/.ssl-key.log
# 2. put /tmp/.ssl-key.log to wireshark TLS pre-master key path
# 3. use following code, setup pyOpenSSL key log callback
certificateOptions = OpenSSLCertificateOptions(
trustRoot=platformTrust(),
acceptableProtocols=[b'h2'],
)
ctx = certificateOptions.getContext()