Skip to content

Instantly share code, notes, and snippets.

View windhooked's full-sized avatar

H windhooked

View GitHub Profile
# Calculate all metric, module and imperial thread pitches
# for a selection of gears.
gears = "20 24 28 30 36 42 44 48 52 56 57 60 66 69 70";
%g = ( 6 => 7 , 5 => 8, 4 => 9, 3 => 10, 2 => 11, 1 => 12 , A => 4, B => 2, C =>1);
$v1 = "1 2 3 4 5 6";
$z1 = "A B C";
#
# 12 11 10 9 8 7
@windhooked
windhooked / golang-tls.md
Created August 12, 2019 07:48 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@windhooked
windhooked / traefik-auth.conf
Created August 20, 2019 14:43 — forked from acundari/traefik-auth.conf
Traefik fail2ban
# /etc/fail2ban/filter.d/traefik-auth.conf
[Definition]
failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) .+\" 401 .+$
@windhooked
windhooked / nginx.conf
Created August 25, 2019 06:43 — forked from atomaths/nginx.conf
This is a FastCGI example server in Go.
## FastCGI
server {
location ~ /app.* {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}
## Reverse Proxy (이 방식으로 하면 http.ListenAndServe로 해야함)
server {
https://blog.golang.org/profiling-go-programs
@windhooked
windhooked / serve.go
Created August 26, 2019 08:18 — forked from paulmach/serve.go
Simple Static File Server in Go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="YOUR-ACCESSKEY"
S3SECRET="YOUR-SECRETKEY"
function putS3
{
path=$1
file=$2
aws_path=$3
// ssh server for windows serving powershell
package main
import (
"fmt"
"io"
"log"
"os/exec"
"github.com/gliderlabs/ssh"
@windhooked
windhooked / gist:0fb7505d71e8607e0dde5f616faffc98
Created December 12, 2019 10:36
Cllection of NoSQL and in memory structured cache in Golang
github.com/siddontang/ledisdb - a high performance NoSQL powered by Go http://ledisdb.com / redis-cli
github.com/HouzuoGuo/tiedot - Your NoSQL database powered by Golang
github.com/coocood/freecache - A cache library for Go with zero GC overhead.
github.com/allegro/bigcache - Efficient cache for gigabytes of data written in Go. http://allegro.tech/2016/03/writing-f…