Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -e
error() {
local sourcefile=$1
local lineno=$2
printf "Error: ${sourcefile}:${lineno}\n\n"
}
trap 'error "${BASH_SOURCE}" "${LINENO}"' ERR

Personal Tech stack

Go

Queue:

  • NATS for messaging queue.

Database:

@QuantumGhost
QuantumGhost / hosts
Created June 17, 2019 23:38 — forked from alswl/hosts
hosts for OpenWRT, for disable AD in xiaomi TV
127.0.0.1 api.ad.xiaomi.com
127.0.0.1 sdkconfig.ad.xiaomi.com
127.0.0.1 ad.mi.com
127.0.0.1 ad.xiaomi.com
127.0.0.1 ad1.xiaomi.com
127.0.0.1 adv.sec.miui.com
127.0.0.1 test.ad.xiaomi.com
127.0.0.1 new.api.ad.xiaomi.com
#!/usr/bin/env bash
CODENAME=buster
APT_MIRROR=https://mirrors.ustc.edu.cn/debian
cat <<EOF | tee /etc/apt/sources.list.d/zfs.list
deb ${APT_MIRROR} ${CODENAME}-backports main contrib
deb-src ${APT_MIRROR} ${CODENAME}-backports main contrib
EOF
@QuantumGhost
QuantumGhost / chez-future.ss
Created August 31, 2019 08:28 — forked from yinwang0/chez-future.ss
experimental implementation of future with Chez Scheme threads
(define-record fitem (result ready mutex cond))
(define future
(lambda (thunk)
(let ([item (make-fitem #f #f (make-mutex) (make-condition))])
(fork-thread
(lambda ()
(let ([result (thunk)])
(with-mutex (fitem-mutex item)
(set-fitem-result! item result)

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support
@QuantumGhost
QuantumGhost / AnIntro.md
Created October 10, 2019 03:46 — forked from chrisdone/AnIntro.md
Statically Typed Lisp

Basic unit type:

λ> replTy "()"
() :: ()

Basic functions:

采取 RESTful 风格的 api 是否应该对结果包一层?

又是基于 HTTP 的 API 设计问题

我个人的想法是:

  1. RESTful 和 RPC 风格各有优劣,具体场景具体分析,但是整体一致最重要,不一致的 API 始终是最糟糕的。

  2. 如果要添加错误码,错误码最好放在 HTTP 头里面,这样可以在不读取 payload 的情况下判断是否存在错误

    例如:X-Error-Code: 10001 或者 X-Error-Code: OUT_OF_CREDIT

@QuantumGhost
QuantumGhost / DefaultKeyBinding.dict
Last active January 31, 2023 15:04
xcode keybindings for emacs emulation
{
/* Override symbols so other apps can bind */
/* ~ stands for option, ^ stands for control */
"~j" = "noop:";
"~i" = "noop:";
"~;" = "noop:";
"~a" = "noop:";
"~2" = "noop:";
"~g" = "noop:";
"~y" = "noop:";
*://*.cengji.com/*
*://*.kknews.cc/*
*://read01.com/*
*://blog.csdn.net/*
*://help.aliyun.com/wordpower/*
*://cloud.tencent.com/developer/information/*
*://www.liankexing.com/*