Skip to content

Instantly share code, notes, and snippets.

Working from home

Lishi He ikbear

Working from home
Block or report user

Report or block ikbear

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile


uptoken 是由PutPolicy经过编码加密得到的,语义如下


字段 类型 语义
scope string 指定为bucket:key这样的形式,bucket必须
deadline int token失效的unix时间戳(单位:秒),必须

Docker Cheat Sheet


Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

ikbear / acces_token.rb
Created May 29, 2014
生成七牛云存储的授权使用的 Access Token
View acces_token.rb
require 'hmac-sha1'
require 'uri'
require 'base64'
def urlsafe_base64_encode(content)
Base64.encode64(content).strip.gsub('+', '-').gsub('/','_').gsub(/\r?\n/, '')
def generate_access_token(access_key, secret_key, url, body)
uri = URI.parse(url)
$accessKey = "aW6EvpZBvWr5Qq3HiFCLiCmvkJORHN8oE-vKR8-z";
$secretKey = "8T270kMZuVZHRjLt6ACKdXj3VAAwPbmeOykQdmOA";
$bucket = "kouqiangzhongzhi";
ikbear / player.html
Last active Aug 29, 2015
https access player
View player.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<title>Sewise Player</title>
<style type="text/css">
margin: 0px;

Distributed Read-Write Mutex in Go

The default Go implementation of sync.RWMutex does not scale well to multiple cores, as all readers contend on the same memory location when they all try to atomically increment it. This gist explores an n-way RWMutex, also known as a "big reader" lock, which gives each CPU core its own RWMutex. Readers take only a read lock local to their core, whereas writers must take all locks in order.

ikbear / binary-search.c
Created May 27, 2015
Binary Search in C
View binary-search.c
#include <stdio.h>
int binary_search(int *a, int length, int target)
int left = 0;
int right = length - 1;
int middle = 0;
while (left <= right)
middle = (left + right) >> 1;

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
ikbear / popmin.c
Created Jul 3, 2015
Pop 最小值的栈
View popmin.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ERROR_DATA -999999
typedef struct {
int *pData;
int length;
int top;
ikbear /
Last active Aug 29, 2015
新 JD




  1. 与产品和服务部门共同设计客户体验管理(CEM)流程
  2. 将确定的客户体验管理流程产品化
  3. 基于收集的数据评估客服体验管理流程的效果,持续改进流程和产品
You can’t perform that action at this time.