View READEME.md
.
├── main.go
└── templates
    ├── confirmation.html
    └── index.html
View READEME.md
├── golang-response-snippets.go
├── images
│   └── had.jpg
├── templates
│   ├── index.html
│   ├── layout.html
│   └── render_string.html
View READEME.md
View 0-rate-limiters.md

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

View frame-summary.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Coverage Report</title>
<link title="Style" type="text/css" rel="stylesheet" href="css/main.css"/>
<link title="Style" type="text/css" rel="stylesheet" href="css/sortabletable.css"/>
<script type="text/javascript" src="js/popup.js"></script>
<script type="text/javascript" src="js/sortabletable.js"></script>
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View app_with_sqlalchemy.py
# coding=utf-8
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from flask_sqlalchemy import get_debug_queries
from ext import db
from users import User
View __init__.py
# coding=utf-8
"""
desc..
:copyright: (c) 2016 by fangpeng(@beginman.cn).
:license: MIT, see LICENSE for more details.
"""
import hmac
import hashlib
import base64
import redis
View auth-token-api.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:Author: beginman.cn
:Mail: pythonsuper@gmail.com
:Created Time: 2017-02-07 16:16:36
:Last modified: 2017-02-07 16:16:36
:Copyright: (c) 2016 by beginman.
:License: MIT, see LICENSE for more details.
"""
View 二叉树链式存储与遍历.c
//
// Created by 方朋 on 2017/1/4.
//
#include <stdio.h>
#include <stdlib.h>
#define OK 1
#define ERROR 0