Skip to content

Instantly share code, notes, and snippets.

View btfak's full-sized avatar

btfak

View GitHub Profile
@btfak
btfak / useHexo.md
Created May 26, 2016 09:41
How to use Hexo and deploy to GitHub Pages

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.

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
http://blog.csdn.net/godleading/article/details/8090917
@btfak
btfak / Sort.java
Last active December 31, 2015 11:59
to peter
import java.util.Scanner;
public class Sort{
private int []letterArray;
private void sortLetter(int length) {
for (int i = 0;i < length-1;i++){
System.out.printf("%d ",letterArray[i]);
letterArray[i] = (letterArray[i] + letterArray[i+1]) % 10;
}
System.out.printf("%d \n",letterArray[length-1]);
@btfak
btfak / Sort.java
Created December 16, 2013 05:17
to peter
public class Sort{
private int []letterArray;
private void sortLetter(int length) {
if (length == 1){
return;
}
for (int i = 0;i < length-1;i++){
letterArray[i] = letterArray[i] + letterArray[i+1];
System.out.printf("%d ",letterArray[i]);
@btfak
btfak / mutilcore.go
Last active December 30, 2015 13:49
//package main
//author: Lubia Yang
//create: 2013-12-6
//refer: www.lubia.me/multicore-scheduler-design
package main
import (
"fmt"
"math/rand"
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@btfak
btfak / server.go
Created November 20, 2013 03:53
递归GC测试server
package main
import (
"fmt"
"net"
"os"
)
var data []byte
var length = 1024 * 100