Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jiacai Liu jiacai2050

🎯
Focusing
View GitHub Profile
@jiacai2050
jiacai2050 / name-calling.md
Created Feb 24, 2021 — forked from coolaj86/name-calling.md
What we call programmers - because labels make us happy! http://youtu.be/uxeR95aYer0#t=58
View name-calling.md
@jiacai2050
jiacai2050 / latency.txt
Created Jan 10, 2021 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
View rust_drop_order.rs
trait Engine {
fn eval(&self) -> String;
}
struct JSEngine {
name: String,
}
impl JSEngine {
fn new(name: String) -> Self {
View .blogbackup.edn
{:description "Blog-backup config"
:home-page "https://github.com/jiacai2050/blog-backup"
:blogs [{:id "go-blog"
:base-url "https://blog.golang.org/index"
:posts-selector "div#content > p > a"
:page-tmpl "{{base-url}}"
:total-page 1}
{:id "meituan"
:base-url "https://tech.meituan.com/"
:posts-selector "div.post-container > h2 > a"
View core_async_expand.cljs
;; (macroexpand '(go (<p! (.launch puppeteer pp-opts))))
(let*
[c__25860__auto__ (cljs.core.async/chan 1)]
(cljs.core.async.impl.dispatch/run
(clojure.core/fn
[]
(clojure.core/let
[f__25861__auto__
(clojure.core/let
@jiacai2050
jiacai2050 / output.txt
Created Apr 18, 2020
Example to reproduce stackoverflow error
View output.txt
thread '
thread 'outer-thread-0' has overflowed its stack
fatal runtime error: stack overflow
outer-thread-1' has overflowed its stack
fatal runtime error: stack overflow
Aborted (core dumped)
@jiacai2050
jiacai2050 / bench_test.go
Created Mar 15, 2020
go value vs pointer benchmark
View bench_test.go
package main
import "testing"
var blackholeStr = ""
var blackholeValue student
var blackholePointer *student
func BenchmarkPointerVSStruct(b *testing.B) {
@jiacai2050
jiacai2050 / web.go
Last active Aug 25, 2020
A simple web app demonstrate how to deal with err in handler
View web.go
package main
import (
"bytes"
"errors"
"io"
"io/ioutil"
"log"
"net/http"
"os"
@jiacai2050
jiacai2050 / Dockerfile
Created Jan 9, 2020
custom prometheus docker file
View Dockerfile
FROM prom/prometheus:v2.12.0
COPY ./start.sh /start.sh
ENTRYPOINT ["/start.sh"]
CMD []