Very simple linear regression
curl -s //www.lauradhamilton.com/data_files/cricket_chirps_versus_temperature.txt | go run main.go > output.svg
2018/06/13 19:57:59 3.3057614388773593*x+24.966014428303183
job "fail-service" { | |
datacenters = ["public-services"] | |
type = "service" | |
group "fail-service" { | |
count = 1 | |
task "fail-service" { | |
driver = "docker" |
/* | |
Note: I have db.MapperFunc(FromCamelCaseToUnderScore) | |
This will make nested json like this | |
{ | |
"likes": [ | |
{ | |
"chat_id": 155636374, | |
"created": "2018-08-04T10:52:36.360217Z", |
Very simple linear regression
curl -s //www.lauradhamilton.com/data_files/cricket_chirps_versus_temperature.txt | go run main.go > output.svg
2018/06/13 19:57:59 3.3057614388773593*x+24.966014428303183
package main | |
import ( | |
"bytes" | |
"image/jpeg" | |
"log" | |
"path" | |
"strings" | |
apex "github.com/apex/go-apex" |
package main | |
import ( | |
"fmt" | |
"strings" | |
"gopkg.in/ldap.v2" | |
) | |
const ( | |
ldapServer = "ad.example.com:389" |
FROM golang:1.6.2 | |
COPY . /go | |
RUN go get github.com/nats-io/nats | |
RUN go build api-server.go | |
EXPOSE 8080 | |
ENTRYPOINT ["/go/api-server"] |
import ( | |
log "github.com/sirupsen/logrus" | |
"github.com/jinzhu/gorm" | |
) | |
type GormLogger struct {} | |
func (*GormLogger) Print(v ...interface{}) { | |
if v[0] == "sql" { | |
log.WithFields(log.Fields{"module": "gorm", "type": "sql"}).Print(v[3]) |
#256 colors in putty, tmux/screen and vim There is a detailed answer on stackoverflow. If you are looking for a short one, here it is.
putty
Set Connection -> Data -> Terminal-type string
to xterm-256color
tmux
Add this line to ~/.tmux.conf
package main | |
import ( | |
"bytes" | |
"crypto/sha256" | |
"crypto/tls" | |
"crypto/x509" | |
"log" | |
"net" | |
"net/http" |