Skip to content

Instantly share code, notes, and snippets.

View spin6lock's full-sized avatar

John Luk spin6lock

View GitHub Profile
@spin6lock
spin6lock / zmqrpc.py
Created May 11, 2012 08:14
zmq rpc demo
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os
import time
import itertools
from weakref import KeyedRef, ref, WeakValueDictionary
import traceback
import functools
import zmq
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@xjdrew
xjdrew / README.md
Last active June 7, 2024 07:15
苹果支付流程

预先说明

目前游戏里面出售的道具,都属于consumable products(消耗性商品),下面的说明流程都是针对这类商品的。别的类型商品处理方法,不完全一样。

注册支付接口回调

app启动的时候即注册支付队列消息的回调者,这个回调者应该是一个单体类,保证在app整个生命周期都存在。ios会回调之前未处理完成的订单。

- (id)init {
    if((self = [super init])) {
        [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
 }
@timothystone
timothystone / zprofile-proxy.txt
Created November 23, 2017 00:39
How I set my proxy in ZSH
#in ZSH, add to ~/.zprofile
set_http_proxy() {
if [ -e $HOME/.proxyrc ]; then
. $HOME/.proxyrc
fi
if [ -z $http_proxy ]; then
echo "No proxy config, environment found, connection attempt failed."
echo "Let's setup a config or update your password."
部分药品援助项目信息
A、中华慈善总会
1、格列卫全球患者援助项目
针对病种:贫困慢性粒细胞白血病患者、急性淋巴细胞白血病患者、恶性胃肠道间质瘤患者及隆突性皮肤纤维肉瘤
项目网址:https://gipap.org.cn
项目热线:400-606-1022
2、多吉美患者援助项目
针对病种:肾癌、肝癌
项目网址:www.ncpap.com.cn
@luxuia
luxuia / profiler.lua
Created August 10, 2018 16:18
sample lua profiler
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
@Jimmy-Z
Jimmy-Z / services-start.sh
Created February 28, 2019 08:42
multi SSID with VLAN script, for ASUS AC86U with merlin
#!/bin/sh
# multi SSID with VLAN script, for ASUS AC86U with merlin
#
# setup before hand:
# set "router" to "AP Mode"
# this will put all ports and wireless in br0
# create 2 guest network
# enable Administration => System => Enable JFFS custom scripts and configs
# put this script in /jffs/scripts/, name should be "services-start"
@natanlao
natanlao / syncthing-photo-sync.md
Last active August 14, 2024 16:29
Syncing iPhone photos with Syncthing

For those who prefer to avoid solutions like iCloud Photos and Dropbox for backing up photos, you can sync your iPhone photos with Syncthing. To do this, you'll need two things:

  • Möbius Sync is, to my knowledge, the only actively-maintained Syncthing client for iOS. It's free to sync up to 20 MB, and only $4.99 (one-time) to remove that limit.

  • PhotoSync is a nifty iOS app for syncing photos to a number of different destinations. It's free for low-quality

#!/usr/bin/env perl
use 5.006001;
use strict;
use warnings;
use Getopt::Long qw( GetOptions );
GetOptions("a=s", \(my $stap_args),
"d", \(my $dump_src),