Skip to content

Instantly share code, notes, and snippets.

View xiangwangfeng's full-sized avatar
🎯
Focusing

阿毛 xiangwangfeng

🎯
Focusing
View GitHub Profile
@xiangwangfeng
xiangwangfeng / objc_mix.py
Created May 14, 2019 09:12
generate objc string variable by ascii code....
import sys
instance_name = "temp"
name = sys.argv[1]
ascii_items = []
for item in name:
ascii_items.append(str(ord(item)))
ascii_str = ",".join(ascii_items)
first_line = "char " + instance_name + "[] = {" + ascii_str + "," + "'\\0'};"
import requests
import sys
import os
import json
MAX_PAGE = 10
def get_projects(gitlab_site,private_token):
projects = []
@xiangwangfeng
xiangwangfeng / latency.txt
Created April 9, 2019 09:37 — 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
@xiangwangfeng
xiangwangfeng / wk.bridge.js
Created April 8, 2019 03:39 — forked from lovesunstar/wk.bridge.js
Provide a way to send event to native.
/* wk.bridge.min.js | v0.2 */
(function() {
if (window.isIOS) {
return
}
window.isIOS = function () {
return navigator && navigator.userAgent && (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent))
}
}());
(function() {
@xiangwangfeng
xiangwangfeng / pre-commit
Created November 29, 2016 09:01 — forked from plu/pre-commit
Pre-commit hook to check for NSLog statements in Objective-C repos
#!/bin/sh
# name this .git/hooks/pre-commit
# chmod +x .git/hooks/pre-commit
# enjoy
IFS=$'\n'
if git-rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
else