$ sudo npm install -g hexo-cli
$ hexo -v
hexo-cli: 0.1.9
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 |
package main | |
import ( | |
"fmt" | |
"labix.org/v2/mgo" | |
"labix.org/v2/mgo/bson" | |
"time" | |
) | |
type Person struct { |
func urlencode(s string) (result string){ | |
for _, c := range(s) { | |
if c <= 0x7f { // single byte | |
result += fmt.Sprintf("%%%X", c) | |
} else if c > 0x1fffff {// quaternary byte | |
result += fmt.Sprintf("%%%X%%%X%%%X%%%X", | |
0xf0 + ((c & 0x1c0000) >> 18), | |
0x80 + ((c & 0x3f000) >> 12), | |
0x80 + ((c & 0xfc0) >> 6), | |
0x80 + (c & 0x3f), |
package main | |
import ( | |
"fmt" | |
"log" | |
"math/rand" | |
"net/http" | |
"time" | |
"github.com/garyburd/redigo/redis" |
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 |
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 |
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.
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
.
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"runtime" | |
"runtime/debug" | |
"runtime/pprof" | |
"strconv" |