Skip to content

Instantly share code, notes, and snippets.

@ikbear
ikbear / acces_token.rb
Created May 29, 2014 04:03
生成七牛云存储的授权使用的 Access Token
require 'hmac-sha1'
require 'uri'
require 'base64'
def urlsafe_base64_encode(content)
Base64.encode64(content).strip.gsub('+', '-').gsub('/','_').gsub(/\r?\n/, '')
end
def generate_access_token(access_key, secret_key, url, body)
uri = URI.parse(url)

Docker Cheat Sheet

Why

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
ikbear / uptoken.md
Created February 10, 2014 08:58
UpToken

uptoken

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

PutPolicy

字段 类型 语义
scope string 指定为bucket:key这样的形式,bucket必须
deadline int token失效的unix时间戳(单位:秒),必须
@ikbear
ikbear / rsf.rb
Created January 3, 2014 03:04
File List
# -*- encoding: utf-8 -*-
require "qiniu/conf"
require "qiniu/rpc"
module Qiniu
module Rsf
class Client
class PutPolicy
include Utils
attr_accessor :scope, :callback_url, :callback_body, :return_url, :return_body, :async_ops, :end_user, :expires, :save_key, :persistent_ops, :persistent_notify_url
def initialize(opts = {})
@scope = opts[:scope]
@callback_url = opts[:callback_url]
@callback_body = opts[:callback_body]
@ikbear
ikbear / put.py
Last active December 27, 2015 08:39
上传测试 upload token
# -*- coding: utf-8 -*-
import os
import sys
import StringIO
sys.path.append("/Users/ikbear/Code/Qiniu/SDK/python-sdk/")
# @gist import_io
import qiniu.io
# @endgist
import qiniu.conf
@ikbear
ikbear / demo.py
Created September 12, 2013 07:26
Qiniu Python SDK Demo
# -*- coding: utf-8 -*-
import os
import sys
import StringIO
# @gist import_io
import qiniu.io
# @endgist
import qiniu.conf
# @gist import_rs
@ikbear
ikbear / callback.go
Last active December 22, 2015 06:58
Callback Handle
package main
import (
"encoding/base64"
"fmt"
"io/ioutil"
"net/http"
gourl "net/url"
"qbox.us/api"
"qbox.us/digest_auth"
@ikbear
ikbear / scala.rb
Created August 31, 2013 00:13 — forked from cstrahan/scala.rb
# to install the latest stable version:
brew install scala --with-docs
# to install scala-2.10.0-RC1:
brew install https://raw.github.com/gist/3939012/scala.rb --with-docs
# to switch versions (from https://github.com/mxcl/homebrew/wiki/External-Commands):
brew switch scala 2.9.2
brew switch scala 2.10.0-RC1

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style