Skip to content

Instantly share code, notes, and snippets.

View higuoxing's full-sized avatar
🍞
Breadcom???

Xing Guo higuoxing

🍞
Breadcom???
View GitHub Profile
@ceberly
ceberly / Makefile
Last active November 13, 2023 17:31
Row vs. Column access patterns
default:
gcc -O0 -g3 -Wall -Wextra -Wconversion -Wdouble-promotion \
-Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion \
main.c
format:
clang-format -i main.c
@yougg
yougg / proxy.md
Last active April 7, 2024 04:02
complete ways to set http/socks/ssh proxy environment variables

set http or socks proxy environment variables

# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT

# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT

# set http proxy with user and password (with special characters)
@soderlind
soderlind / Install.txt
Last active March 5, 2024 20:30
macOS DoH! (DNS over HTTPS) using cloudflared
1) Install cloudflared using homebrew:
brew install cloudflare/cloudflare/cloudflared
2) Create /usr/local/etc/cloudflared/config.yaml, with the following content
proxy-dns: true
proxy-dns-upstream:
- https://1.1.1.1/dns-query
- https://1.0.0.1/dns-query
1、安装arcanist,clone源代码到安装目录somewhere/,arcanist依赖于libphutil,所以两个都要clone
somewhere/ git clone git://github.com/facebook/arcanist.git
somewhere/ git clone git://github.com/facebook/libphutil.git
2、配置arc,将arc加入到PATH,或在/usr/sbin里面建一个到arc的软链接
export PATH=$PATH:/somewhere/arcanist/bin/
或者:cd /usr/sbin; ln -sf /somewhere/arcanist/bin/arc
* 在系统的~/.bashrc或~/.bash_profile中加上该export语句。
* 运行命令"arc help",来检测安装是否成功。
3、配置arc的编辑器,不然会报错,提示EDITOR环境变量没配置
arc set-config editor "vim"
@evantoli
evantoli / GitConfigHttpProxy.md
Last active April 26, 2024 17:21
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

Android Emulator usage: emulator [options] [-qemu args]
options:
-sysdir <dir> search for system disk images in <dir>
-system <file> read initial system image from <file>
-datadir <dir> write user data into <dir>
-kernel <file> use specific emulated kernel
-ramdisk <file> ramdisk image (default <system>/ramdisk.img
-image <file> obsolete, use -system <file> instead
-initdata <file> same as '-init-data <file>'
-data <file> data image (default <datadir>/userdata-qemu.img
@jboner
jboner / latency.txt
Last active May 6, 2024 07:06
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
@eparreno
eparreno / gist:1845561
Created February 16, 2012 15:17
Install libmagic on Mac OS X via homebrew
$ brew install libmagic
$ brew link libmagic (if the link is already created is going to fail, don't worry about that)
$ env ARCHFLAGS="-arch x86_64" gem install ruby-filemagic -- --with-magic-include=/usr/local/include --with-magic-lib=/usr/local/lib/