Skip to content

Instantly share code, notes, and snippets.


R+ nirui

View GitHub Profile
View traefik-docker-stack.yaml
# Modified based on
# Hope it helps :)
version: '3'
image: traefik:v2.4.3
View local-dns-proxy.go
// This program and script allows you to map the dns request to [domain].<lan-hostname>.svc.lan to <lan-hostname>.
// 1. Setup the OpenWrt. File /etc/config/dhcp
// config dnsmasq
// ....
// list server '/svc.lan/'
// list rebind_domain 'svc.lan'
// 2. Init.d Script: /etc/init.d/
View goroutine_chan_send_obj_test.go
package main
import "testing"
import "sync"
type obj struct {
test string
type obj2 struct {

Keybase proof

I hereby claim:

  • I am nirui on github.
  • I am nirui ( on keybase.
  • I have a public key whose fingerprint is B412 2F2C 5F8F 6807 43C3 273B 82AE 11AD 1E5E 8729

To claim this, I am signing this object:

View Don't reuse the ciphertext buffer like this.go
package main
import (
func decrypt(key, nonce, buf []byte, bufPadLength int) {
block, err := aes.NewCipher(key[:])
nirui / To Deploy A
Last active Jul 14, 2022
To deploy a proxy
View To Deploy A

To deploy a proxy

Copyright (C) 2020 RUI Ni (

This is a document on how to depoly a reasonably secured proxy server which is capable of relaying non-critical communications and few other tasks.

Given the fact that this document is largely a personal note and memo, information and method provided in this document may NOT be useful for your use case. Do NOT follow the content if you don't fully understand the information and instruction.

The document also assumes the reader has decent amont of knownledge about Linux server. Because of that, step-by-step guide will not be provided, the reader must install and fine tune the softwares by themselves.

while true; do
while true; do
sleep 1
View time_now_test.go
package main
import (
func BenchmarkTimeNow(b *testing.B) {
for i := 0; i < b.N; i++ {
View go_range_vs_index_test.go
package main
import (
var sample = makeSample()
const sampleSize = 4096