I hereby claim:
- I am ammarpw on github.
- I am ammar (https://keybase.io/ammar) on keybase.
- I have a public key whose fingerprint is ADF9 EF5C AF59 5200 DC76 B4FF 1C0F 6A4C 777E 4FE4
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| //Removed in favor of https://github.com/ammario/temp |
| func cError(c *gin.Context, err interface{}) { | |
| switch err.(type) { | |
| case error: | |
| c.JSON(200, gin.H{ | |
| "error": err.(error).Error(), | |
| }) | |
| case string: | |
| c.JSON(200, gin.H{ | |
| "error": err.(string), | |
| }) |
| package main | |
| import ( | |
| "database/sql" | |
| _ "github.com/go-sql-driver/mysql" | |
| ) | |
| func main() { | |
| mysqlConn, err := sql.Open("mysql", os.Getenv("MYSQL_USER")+":"+os.Getenv("MYSQL_PASS")+"@("+os.Getenv("MYSQL_HOST")+")/"+os.Getenv("MYSQL_DB") + "?parseTime=true") | |
| if err != nil { |
I hereby claim:
To claim this, I am signing this object:
| func ip2int(ip net.IP) uint32 { | |
| if len(ip) == 16 { | |
| return binary.BigEndian.Uint32(ip[12:16]) | |
| } | |
| return binary.BigEndian.Uint32(ip) | |
| } | |
| func int2ip(nn uint32) net.IP { | |
| ip := make(net.IP, 4) | |
| binary.BigEndian.PutUint32(ip, nn) |
| #!/bin/bash | |
| set -euf -o pipefail | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "This script must be run as root" | |
| exit 1 | |
| fi | |
| rm -rf /usr/local/go || true | |
| rm /usr/local/bin/go || true |
| package main | |
| import ( | |
| "github.com/stratexio/gclog" | |
| "golang.org/x/net/context" | |
| "google.golang.org/cloud" | |
| "google.golang.org/cloud/storage" | |
| ) | |
| #!/bin/bash | |
| go test -coverprofile=coverage.out | |
| go tool cover -html=coverage.out |
| #!/bin/bash | |
| set -e | |
| sudo yum -y install wget git | |
| wget -O /tmp/go.tar.gz https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz | |
| sudo tar -C /usr/local -xzf /tmp/go.tar.gz | |
| ln -s /usr/local/go/bin/go /usr/bin/go | |
| # Install glide | |
| export GOPATH=~/go | |
| mkdir -p ~/go/bin |