新款的树莓派3B功能之丰富,性能之强悍,让我垂涎。考虑到家里的网件 WNDR3700v2 也服役四年有余了。还是败了一个树莓派3B回来打造成新的路由。
WARNING
本文所有指令均仅供参考,切勿无脑复制粘贴!
〇 安装系统
新款的树莓派3B功能之丰富,性能之强悍,让我垂涎。考虑到家里的网件 WNDR3700v2 也服役四年有余了。还是败了一个树莓派3B回来打造成新的路由。
WARNING
本文所有指令均仅供参考,切勿无脑复制粘贴!
〇 安装系统
package main | |
import ( | |
"net/http" | |
) | |
type SingleHost struct { | |
handler http.Handler | |
allowedHost string | |
} |
//usr/bin/env go run $0 "$@"; exit | |
package main | |
import ( | |
"fmt" | |
"os" | |
) | |
func main() { | |
fmt.Println("Hello world!") |
This is a collection of working commandline examples to show how one could use FFMpeg and VLC for live transcoding of video streams. All examples have been tested on OSX 10.7.5 with FFMPeg 1.1.3 and VLC 2.0.5 in early 2013.
Documentation links
package proxy | |
import ( | |
"io" | |
"log" | |
"net" | |
) | |
func Proxy(srvConn, cliConn *net.TCPConn) { | |
// channels to wait on the close event for each connection |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"html/template" | |
"github.com/gorilla/sessions" |
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
# Create specified number of articles for Hugo benchmarks | |
from datetime import datetime | |
import random | |
import string | |
from sys import argv | |
def generateWord(): | |
length = random.randint(1, 10) | |
word = ''.join(random.choice(string.letters) for _ in range(length)) |
/** | |
This function creates a connection to the database. It shouldn't have to know anything | |
about the pool, It will be called N times where N is the size of the requested pool. | |
*/ | |
func initCirrusConnections() (interface{}, error) { | |
dbserver, _ := configFile.GetString("default", "dbserver") | |
dbuser, _ := configFile.GetString("default", "dbuser") | |
dbpass, _ := configFile.GetString("default", "dbpass") | |
db := autorc.New("tcp", "", dbserver, dbuser, dbpass) |
type InitFunction func() (interface{}, error) | |
type ConnectionPoolWrapper struct { | |
size int | |
conn chan interface{} | |
} | |
/** | |
Call the init function size times. If the init function fails during any call, then | |
the creation of the pool is considered a failure. |