Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

cbluth

🌴
On vacation
View GitHub Profile
@cbluth
cbluth / catalina_devkitpro_setup.md
Created Aug 26, 2020 — forked from joshenders/catalina_devkitpro_setup.md
Getting started with Nintendo Switch Development using devkitpro on macOS
View catalina_devkitpro_setup.md

Getting started with Nintendo Switch Development using devkitpro on macOS

Prerequsite: Ensure Xcode command line tools are installed

xcode-select --install

Install the devkitpro Package Manager

@cbluth
cbluth / gist:f51063b1f86e6bb3934357cb658c232f
Created Aug 6, 2020 — forked from RichiH/gist:f2ffb824d428d8ca0c7c40cd62022b56
Prometheus relabelling to get rid of port number
View gist:f51063b1f86e6bb3934357cb658c232f
============================================
============================================
============================================
This does what it should:
regex: (.+?)(:80)?
Also see https://golang.org/pkg/regexp/syntax/
@cbluth
cbluth / wireguard_userspace.sh
Created Jul 30, 2020 — forked from svet-b/wireguard_userspace.sh
Install WireGuard userspace on Linux
View wireguard_userspace.sh
sudo apt update && sudo apt upgrade
sudo apt install golang
sudo apt-get install libmnl-dev libelf-dev build-essential pkg-config
git clone https://git.zx2c4.com/wireguard-go
cd wireguard-go/
git checkout 0.0.20181001 # Get the desired release tag from `git tag`
make
sudo make install
@cbluth
cbluth / nginx-geoip-module.md
Created Jul 28, 2020 — forked from VirtuBox/nginx-geoip-module.md
How to configure GeoIP module for Nginx
View nginx-geoip-module.md

Create a folder to store the databases :

mkdir -p /usr/share/GeoIP

Download Country IP database

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
@cbluth
cbluth / block-tor.sh
Created Apr 16, 2020 — forked from tiagoad/block-tor.sh
Cronjob to block tor exit nodes with nginx on debian 8 jessie
View block-tor.sh
wget -qO- https://check.torproject.org/exit-addresses | grep ExitAddress | cut -d ' ' -f 2 | sed "s/^/deny /g; s/$/;/g" > /etc/nginx/conf.d/tor-block.conf; systemctl reload nginx
@cbluth
cbluth / udpProxy.go
Created Mar 26, 2020 — forked from mike-zhang/udpProxy.go
Implementation of a UDP proxy in Golang
View udpProxy.go
// Implementation of a UDP proxy
package main
import (
"flag"
"fmt"
"log"
"net"
"os"
@cbluth
cbluth / client.go
Created Mar 25, 2020 — forked from elico/client.go
golang tcp client connection alive check
View client.go
package main
import (
"fmt"
"io"
"net"
"time"
)
func main() {
@cbluth
cbluth / file_response_writer.go
Created Mar 22, 2020 — forked from ismasan/file_response_writer.go
Write backend HTTP response to http.ResponseWriter and File
View file_response_writer.go
// fileResponseWriter wraps an http.ResponseWriter and a File
// passing it to an http.Handler's ServeHTTP
// will write to both the file and the response.
type fileResponseWriter struct {
file io.Writer
resp http.ResponseWriter
multi io.Writer
}
@cbluth
cbluth / sortByteSlice.go
Created Mar 9, 2020 — forked from schmohlio/sortByteSlice.go
sort byte slices in Golang without needing to fmt as string. useful for Set hashes
View sortByteSlice.go
package main
import (
"bytes"
"log"
"sort"
)
// implement `Interface` in sort package.
type sortByteArrays [][]byte
@cbluth
cbluth / dht-walkthrough.md
Created Mar 8, 2020 — forked from gubatron/dht-walkthrough.md
DHT walkthrough notes
View dht-walkthrough.md

DHT Walkthrough Notes

I've put together these notes as I read about DHT's in depth and then learned how the libtorrent implementation based on the Kademlia paper actually works.

What problem does this solve?

400,000,000,000 (400 billion stars), that's a 4 followed by 11 zeros. The number of atoms in the universe is estimated to be around 10^82. A DHT with keys of 160 bits, can have 2^160 possible numbers, which is around 10^48

You can’t perform that action at this time.