Skip to content

Instantly share code, notes, and snippets.

View QuantumGhost's full-sized avatar
🇯🇵

QuantumGhost QuantumGhost

🇯🇵
  • 0xB29A14086516184D
  • 07:03 (UTC +08:00)
View GitHub Profile
package main
import "time"
// https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
type Client struct {
addr string
timeout time.Duration
}
-------------------------------------------------
nench.sh v2019.07.20 -- https://git.io/nench.sh
benchmark timestamp: 2021-05-30 14:40:17 UTC
-------------------------------------------------
Processor: DO-Premium-AMD
CPU cores: 1
Frequency: 1999.947 MHz
RAM: 989Mi
Swap: -
package temp
import (
"fmt"
"github.com/rs/zerolog"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"io/ioutil"
"testing"
@QuantumGhost
QuantumGhost / disable-macos-notarization.md
Created May 9, 2020 02:31
disable notarization on macOS Catalina

Catalina's notarization is a disaster for cli apps. You may like to disable it with the following command:

sudo spctl --master-disable

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

*://*.cengji.com/*
*://*.kknews.cc/*
*://read01.com/*
*://blog.csdn.net/*
*://help.aliyun.com/wordpower/*
*://cloud.tencent.com/developer/information/*
*://www.liankexing.com/*
@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:";

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

又是基于 HTTP 的 API 设计问题

我个人的想法是:

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

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

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

@QuantumGhost
QuantumGhost / AnIntro.md
Created October 10, 2019 03:46 — forked from chrisdone/AnIntro.md
Statically Typed Lisp

Basic unit type:

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

Basic functions:

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