Skip to content

Instantly share code, notes, and snippets.

https://github.com/devlinkcn
@xjdrew
xjdrew / client.go
Last active June 20, 2024 07:39
golang tls client and server, require and verify certificate in double direction
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
@walm
walm / main.go
Last active May 15, 2024 06:01
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@snakevil
snakevil / router.pi-3.md
Last active August 12, 2018 03:00
使用树莓派3B打造超强路由之三:阴影

使用树莓派3B打造超强路由之三:阴影

在[《使用树莓派3B打造超强路由之二:初成》][之二:初成]之后,似乎接下来的工作,就是朝着整合网络扩展存储 NAS家庭影院电脑 HTPC 去努力了。但在此之前,省视实际需求,不难发现其中的阴影——公共需求和私人需求存在显著差异——如:儿童能接触到的、成年人能接触到的和我能接触到的,如何区分开?所以在开始整合前,先尝试解决这个问题。

WARNING 本文所有指令均仅供参考,切勿无脑复制粘贴!

〇 前文提要

@snakevil
snakevil / router.pi-2.md
Last active September 27, 2023 02:25
使用树莓派3B打造超强路由之二:初成

使用树莓派3B打造超强路由之二:初成

通过第一篇《使用树莓派3B打造超强路由之一:初装》的努力,树莓派3B已经可以作为一台超低能耗、随身携带的开发用服务器来使用了。但这对于目标——打造超强路由而言,才刚刚开始。接下来,我们需要将其打磨成一台基本的无线路由器。

WARNING 本文所有指令均仅供参考,切勿无脑复制粘贴!

@snakevil
snakevil / router.pi-1.md
Last active April 16, 2024 20:57
使用树莓派3B打造超强路由之一:初装

使用树莓派3B打造超强路由之一:初装

新款的树莓派3B功能之丰富,性能之强悍,让我垂涎。考虑到家里的网件 WNDR3700v2 也服役四年有余了。还是败了一个树莓派3B回来打造成新的路由。

WARNING 本文所有指令均仅供参考,切勿无脑复制粘贴!

〇 安装系统

@zchee
zchee / cgo.md
Last active July 14, 2024 14:58
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

@jouyouyun
jouyouyun / shadowsocks-libev.md
Created September 1, 2015 08:25
Shadowsocks libev

shadowsocks-libev

Intro

Shadowsocks-libev is a lightweight secured socks5 proxy for embedded devices and low end boxes.

It is a port of shadowsocks

@oblank
oblank / bleve_with_jieba.go
Last active May 14, 2024 15:57
bleve结合 jieba 分词实现中文分词
package main
import (
"fmt"
"github.com/blevesearch/bleve"
_ "github.com/wangbin/jiebago/analyse/tokenizers"
"log"
)
func main() {
@PiBa-NL
PiBa-NL / haproxy, sending the source ip to the webserver.
Created December 21, 2014 23:24
haproxy, sending the source ip to the webserver.
To send the ip addres of the client/webbrowser to the server/webserver behind it there are a few options:
1- option forwardfor
2- send-proxy
3- source 0.0.0.0 usesrc clientip
1- option forwardfor
This is an easy option to configure in haproxy, it does require that http layer7 processing is used 'mode http' and the webserver/ webapplication that wants to log or use the ip of the client must use the http-header 'X-Forwarded-For' to read the clientip.
2- send-proxy / send-proxy-v2 / send-proxy-*
This is can be used both with mode tcp and http, it does however require that the server also understands the proxyprotocol. Some applications have added support for this protocol which adds a few bytes with ip information before the actual request.