Skip to content

Instantly share code, notes, and snippets.

View fundon's full-sized avatar
🎯
Focusing

Fangdun Tsai fundon

🎯
Focusing
View GitHub Profile
@fundon
fundon / smol-hello.rs
Last active January 23, 2024 08:34
smol 16threads vs tokio 16threads
//! An HTTP server based on `hyper`.
//!
//! Run with:
//!
//! ```
//! cargo run --example hyper-server
//! ```
//!
//! Open in the browser any of these addresses:
//!
@fundon
fundon / README.md
Created August 6, 2021 14:25 — forked from ctsrc/README.md
How to run FreeBSD 13.0-BETA1 for ARM64 in QEMU on Apple Silicon Mac (MacBook Pro M1, etc)
@fundon
fundon / hosts
Created June 10, 2011 05:48
/etc/hosts or C:\WINDOWS\system32\drivers\etc\hosts
# IPV4
## github
207.97.227.245 www.github.com
## google
203.208.39.22 webcache.googleusercontent.com
203.208.39.22 mail.google.com
203.208.39.22 reader.google.com
203.208.39.22 www.google.com.hk
@fundon
fundon / loadcss.js
Created December 15, 2011 08:29
load css
(function(doc, type) {
var head = doc.getElementsByTagName('head')[0],
frag = doc.createDocumentFragment(),
add = function(url, id) {
if (doc.getElementById(id)) {return;}
var node = doc.createElement(type);
node.href = url;
id && (node.id = id);
//node.rel = 'stylesheet';
//node.type = 'text/css'
@fundon
fundon / socket_redis_v1.py
Created May 27, 2011 09:16
Simple use socket connect redis
#!/usr/bin/env python
import socket, time
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 6379))
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
time.sleep(2)
sock.sendall('PING\r\n')
print repr(sock.recv(4096))
time.sleep(2)
@fundon
fundon / docs.md
Last active November 3, 2021 02:57
Docs 构建引擎

特点

  • 代码复制
  • 版本搜索
  • 多版本搜索
  • 实时搜索
  • 快速更新索引
  • 文档站点 TOC
  • 页面 TOC
  • MarkdownLint
@fundon
fundon / count_utf8.js
Created May 21, 2012 14:39 — forked from frne/count_utf8.js
Function to count bytes of a string (UTF8)
/**
* Function to fix native charCodeAt()
*
* Now, we can use fixedCharCodeAt("foo€", 3); for multibyte (non-bmp) chars too.
*
* @access public
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/charCodeAt
* @note If you hit a non-bmp surrogate, the function will return false
* @param str String Mixed string to get charcodes
* @param idx Integer Position of the char to get
@fundon
fundon / .profile
Last active July 16, 2021 05:54
New macOS
# ~/.profile
export HTTP_PROXY=http://127.0.0.1:9090
export HTTPS_PROXY=http://127.0.0.1:9090
export PATH="$HOME/.cargo/bin:$PATH"
@fundon
fundon / hello.rs
Created April 29, 2020 07:17
smol spawn vs tokio spawn
//! An HTTP server based on `hyper`.
//!
//! Run with:
//!
//! ```
//! cargo run --example hyper-server
//! ```
//!
//! Using https://github.com/mcollina/autocannon
//! ```
@fundon
fundon / oc.fish
Created March 4, 2020 09:59
Opencore Builder includes Drivers and Kexts
#!/usr/bin/env fish
function build
set -l mode $argv[1]; set -q $mode ; and set mode Debug
xcodebuild -configuration $mode > /dev/null
end
function package
set -l mode $argv[1]
set -l repo $argv[2]