Skip to content

Instantly share code, notes, and snippets.

View leepro's full-sized avatar
🏠
Working from home

DW Lee leepro

🏠
Working from home
View GitHub Profile
@leepro
leepro / gist:72f9bd1d6aeaa49069a02a61a8d81fa4
Created January 28, 2017 18:41 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "[email protected]:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@leepro
leepro / custom-error-page
Created October 6, 2016 18:32 — forked from simlegate/custom-error-page
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@leepro
leepro / main.go
Created September 10, 2016 17:38 — forked from julz/main.go
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@leepro
leepro / sse.go
Created August 30, 2016 05:35 — forked from ismasan/sse.go
Example SSE server in Golang
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// Example SSE server in Golang.
@leepro
leepro / golang-tls.md
Created July 13, 2016 03:13 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
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)
openssl ecparam -genkey -name secp384r1 -out server.key
@leepro
leepro / c.h
Created April 12, 2016 16:47 — forked from lorepozo/c.h
Golang cgo objective-c cocoa button callback
#include <Cocoa/Cocoa.h>
extern void ButtonClick(void);
@interface GoPasser : NSObject
+ (void)buttonClick:(id)sender; // this should call the cgo function defined in main.go
@end
void StartApp(void);
package main
import (
"net/http"
)
type SingleHost struct {
handler http.Handler
allowedHost string
}
@leepro
leepro / example.go
Created April 5, 2016 15:17 — forked from kavu/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@leepro
leepro / git-loglive
Created December 7, 2015 20:21 — forked from tlberglund/git-loglive
Log Live Git Command
#!/bin/bash
while :
do
clear
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $*
sleep 1
done
@leepro
leepro / gist:716bb0feded9a09d7fea
Created November 8, 2015 04:29 — forked from iwanbk/gist:2295233
TCP Echo Client in Golang
package main
import (
"net"
"os"
)
func main() {
strEcho := "Halo"
servAddr := "localhost:6666"
tcpAddr, err := net.ResolveTCPAddr("tcp", servAddr)