Skip to content

Instantly share code, notes, and snippets.

View jiacai2050's full-sized avatar
🏓
Focusing

Jiacai Liu jiacai2050

🏓
Focusing
View GitHub Profile
@jiacai2050
jiacai2050 / docker-registry-mirrors.md
Created March 7, 2024 13:56 — forked from y0ngb1n/docker-registry-mirrors.md
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@jiacai2050
jiacai2050 / libpq-demo.cc
Created December 28, 2023 14:35 — forked from ictlyh/libpq-demo.cc
libpq examples.
/*
* Demo of libpq.
* Build: g++ libpq-demo.cc -o libpq-demo -lpq
* Run: ./libpq-demo
*/
#include <arpa/inet.h>
#include <iostream>
#include <libpq-fe.h>
#include <sstream>
@jiacai2050
jiacai2050 / gist:4130861eba1c4b13505259d28d158091
Created December 18, 2023 07:22 — forked from payam-int/gist:edf977c6af603fee0ce1b05da7792fe7
Prometheus Node Exporter - CPU and Memory Usage

CPU Usage :

(1 - avg(irate(node_cpu_seconds_total{mode="idle"}[10m])) by (instance)) * 100

Memory Usage :

100 * (1 - ((avg_over_time(node_memory_MemFree_bytes[10m]) + avg_over_time(node_memory_Cached_bytes[10m]) + avg_over_time(node_memory_Buffers_bytes[10m])) / avg_over_time(node_memory_MemTotal_bytes[10m])))
@jiacai2050
jiacai2050 / async_await_cancellation.md
Created January 13, 2023 12:22 — forked from Matthias247/async_await_cancellation.md
Async/Await - The challenges besides syntax - Cancellation

Async/Await - The challenges besides syntax - Cancellation

This is the second article in a series of articles around Rusts new async/await feature. The first article about interfaces can be found here.

In this part of the series we want to a look at a mechanism which behaves very different in Rust than in all other languages which feature async/await support. This mechanism is Cancellation.

@jiacai2050
jiacai2050 / zig-blog-posts.md
Created July 18, 2022 02:41 — forked from LewisGaul/zig-blog-posts.md
Collection of blog posts about the Zig programming language
@jiacai2050
jiacai2050 / osx-ld.md
Created March 28, 2022 14:29 — forked from loderunner/osx-ld.md
potential blog posts

ld – Wading through Mac OS X linker hell

Intro

Friend: I tried looking at static linking in Mac OS X and it seems nearly impossible. Take a look at this http://stackoverflow.com/a/3801032

Me: I have no idea what that -static flag does, but I'm pretty sure that's not how you link to a library. Let me RTFM a bit.

Minutes later...

@jiacai2050
jiacai2050 / name-calling.md
Created February 24, 2021 15:03 — forked from coolaj86/name-calling.md
What we call programmers - because labels make us happy! http://youtu.be/uxeR95aYer0#t=58
@jiacai2050
jiacai2050 / latency.txt
Created January 10, 2021 09:33 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
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
@jiacai2050
jiacai2050 / trrprefs.md
Created March 9, 2018 06:27 — forked from bagder/trrprefs.md
trr prefs

Preferences

All preferences for the DNS-over-HTTPS functionality in Firefox are located under the "network.trr" prefix (TRR == Trusted Recursive Resolver).

network.trr.mode

set which resolver mode you want.

0 - Off (default). use standard native resolving only (don't use TRR at all)

1 - Race native against TRR. Do them both in parallel and go with the one that returns a result first.