This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"go/scanner" | |
"go/token" | |
"math" | |
"sync" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// parseArgs(os.Args) | |
func parsArgs(args []string) ([]string, map[string][]string) { | |
argMap := make(map[string][]string) | |
arguments := []string{} | |
for i := 1; i < len(args); { | |
if args[i][0] == '-' { | |
j := i + 1 | |
argMap[args[i][1:]] = []string{} | |
for j = i + 1; j < len(args) && len(args[j]) > 0 && args[j][0] != '-'; j++ { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
user nobody nogroup; | |
# 'user nobody nobody;' for systems with 'nobody' as a group instead | |
pid /run/nginx.pid; | |
# error_log /tmp/nginx.error.log; | |
events { | |
worker_connections 1024; # increase if you have lots of clients | |
accept_mutex off; # set to 'on' if nginx worker_processes > 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// golang http2 example | |
// run these before: openssl genrsa -out server.key 2048 | |
// openssl ecparam -genkey -name secp384r1 -out server.key | |
// openssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650 | |
package main | |
import ( | |
"log" | |
"net/http" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mostly based on https://labix.org/mgo | |
package id | |
import ( | |
"crypto/md5" | |
"crypto/rand" | |
"encoding/binary" | |
"fmt" | |
"io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"path/filepath" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
max := 1000 | |
for a := 0; a < 8; a++ { | |
for b := 0; b < 8; b++ { | |
func(a, b int) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
const Count = 3 | |
var Goal = State{0, 0, R, ""} | |
func main() { | |
fmt.Println("breadthFirstSearch") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"crypto/ecdsa" | |
"crypto/elliptic" | |
"crypto/rand" | |
"crypto/rsa" | |
"crypto/tls" | |
"crypto/x509" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mgocert | |
import ( | |
"context" | |
"golang.org/x/crypto/acme/autocert" | |
mgo "gopkg.in/mgo.v2" | |
) | |
type Cache struct { |
OlderNewer