Skip to content

Instantly share code, notes, and snippets.

Avatar

btfak

View GitHub Profile
View rate-limiting-with-redis.md

Rate limiting with Redis

June 2011 - Chris O'Hara - (archived original post)

Rate limiting can be an effective way of conserving resources and preventing automated or nefarious activities on your site.

A common use case is to limit the amount of requests an IP can make over a certain time frame. For example, you might want to restrict users from using an expensive search utility on your site. If the user attempts to search more than 5 times a minute, you can redirect them to another page informing them that they need to wait.

IP based rate limiting is already in use on larger sites. Google and Yahoo both employ the technique to prevent (or at least complicate) automated requests to their services.

View git 设置和取消代理
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
View 内存对其算法
http://blog.csdn.net/godleading/article/details/8090917
@btfak
btfak / useHexo.md
Created May 26, 2016
How to use Hexo and deploy to GitHub Pages
View useHexo.md
View shortener.go
package main
import (
"fmt"
"log"
"math/rand"
"net/http"
"time"
"github.com/garyburd/redigo/redis"
View doubangroupapi
import requests
from db import db
"""
The Douban Group API which not display on http://developers.douban.com/wiki/?title=api_v2
Base url: https://api.douban.com/v2
Group info: /group/:id
View doubangroupapi
import requests
from db import db
"""
The Douban Group API which not display on http://developers.douban.com/wiki/?title=api_v2
Base url: https://api.douban.com/v2
Group info: /group/:id
View ngrok-selfhosting-setup.md

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

View profilingtool.go
package main
import (
"fmt"
"log"
"os"
"runtime"
"runtime/debug"
"runtime/pprof"
"strconv"
You can’t perform that action at this time.