This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package controllers | |
| import ( | |
| "encoding/base64" | |
| "errors" | |
| "github.com/robfig/revel" | |
| "net/http" | |
| "strings" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| ''' | |
| 功能: | |
| 从zonefile文件导入域名到Dnspod | |
| requirements: | |
| dnspython==1.10.0 | |
| requests==1.0.4 | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import datetime | |
| from bs4 import BeautifulSoup | |
| import random | |
| def get_page(url): | |
| r=requests.get(url,headers={"content-type":"text","User-Agent":"Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11"}) | |
| return BeautifulSoup(r.text) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.android.volley.NetworkResponse; | |
| import com.android.volley.Request; | |
| import com.android.volley.Response; | |
| import com.android.volley.VolleyLog; | |
| import com.fasterxml.jackson.core.JsonProcessingException; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import java.io.IOException; | |
| public abstract class JacksonJsonRequest<T> extends Request<T> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ( | |
| "database/sql" | |
| "github.com/robfig/revel" | |
| _ "github.com/ziutek/mymysql/godrv" | |
| ) | |
| var ( | |
| db *sql.DB | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "database/sql" | |
| "errors" | |
| "fmt" | |
| _ "github.com/bmizerany/pq" | |
| "os" | |
| "regexp" | |
| "strings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ovs-vsctl add-port <bridge name> <port name> | |
| ovs-vsctl set interface <port name> type=patch | |
| ovs-vsctl set interface <port name> options:peer=<peer name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| A minimal example of how to use Paste and WebOb to build a custom | |
| WSGI app and serve it. | |
| Depends on: | |
| * paste - http://pypi.python.org/pypi/Paste | |
| * webob - http://pypi.python.org/pypi/WebOb/1.1.1 | |
| * routes - http://pypi.python.org/pypi/Routes/1.12.3 | |
| I (marmida) still think this is less appropriate than using CouchDB; you'll need |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding:utf-8 -*- | |
| '写了一个简单的支持中文的正向最大匹配的机械分词,其它不用解释了,就几十行代码' | |
| '搜狗词库下载地址:http://vdisk.weibo.com/s/7RlE5' | |
| import string | |
| __dict = {} | |
| def load_dict(dict_file='words.dic'): | |
| '加载词库,把词库加载成一个key为首字符,value为相关词的列表的字典' |