Skip to content

Instantly share code, notes, and snippets.

@jtbonhomme
jtbonhomme / docker-compose.yml
Last active January 3, 2019 16:55
Docker swarm config and secret initialisation
version: '3.6'
services:
users:
image: /path/to/registry/users:latest
secrets:
- source: database
target: /.env/database
configs:
- source: smtp
@jtbonhomme
jtbonhomme / discrete.go
Created December 22, 2018 11:30
Time series computed from a discrete derivative of a simple counter.
package main
import (
"log"
"net/http"
"time"
"math/rand"
chart "github.com/wcharczuk/go-chart"
"github.com/wcharczuk/go-chart/drawing"
)
@jtbonhomme
jtbonhomme / norm2.go
Created December 22, 2018 11:09
Normal distribution generated data with color and x-axis legend
package main
import (
"log"
"net/http"
"time"
"math/rand"
chart "github.com/wcharczuk/go-chart"
"github.com/wcharczuk/go-chart/drawing"
)
@jtbonhomme
jtbonhomme / rand.go
Created December 22, 2018 10:44
Pure random data generator
package main
import (
"log"
"net/http"
"time"
"math/rand"
chart "github.com/wcharczuk/go-chart"
)
@jtbonhomme
jtbonhomme / norm.go
Last active December 22, 2018 10:45
Normal Distribution random data generator
package main
import (
"log"
"net/http"
"time"
"math/rand"
chart "github.com/wcharczuk/go-chart"
)

Awless template to start/stop a list of instances

@jtbonhomme
jtbonhomme / git-origins.md
Created October 29, 2018 10:55 — forked from benschw/git-origins.md
fork a repo manually (set source as upstream origin) rather than with the "fork" button. e.g. for in github when you want to fork a project twice.

Ripped off from adrianshort.org

List curent remotes

$ git remote -v

origin  https://github.com/hakimel/reveal.js.git (fetch)
origin  https://github.com/hakimel/reveal.js.git (push)

Rename origin to upstream and add our new empty repo as the origin.

@jtbonhomme
jtbonhomme / deployment_to_gitlab_pages.md
Created October 14, 2018 18:03 — forked from shyiko/deployment_to_gitlab_pages.md
Deploying to GitLab Pages (on each push)

(assuming project is hosted on GitLab)

  1. Enable shared runners by going to "Settings" > "Runners".
  2. Add .gitlab-ci.yml with the following content:
image: node:6.9.1
pages: 
  artifacts: 
paths: 
@jtbonhomme
jtbonhomme / hasMany.go
Created May 22, 2018 11:11
Gorm example of foreign key definition for a hasMany relation
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
)
// Customer ...
type Customer struct {
@jtbonhomme
jtbonhomme / multiline.md
Created April 25, 2018 11:41
Pass multi line to a file
$ cat <<EOF > print.sh
#!/bin/bash
echo \$PWD
echo $PWD
EOF