Skip to content

Instantly share code, notes, and snippets.

View jwreagor's full-sized avatar

J R jwreagor

  • New Gillington, WI
View GitHub Profile
package main
import (
"context"
"fmt"
"os"
"github.com/jackc/pgtype"
"github.com/jackc/pgx"
)
@jwreagor
jwreagor / sshd.go
Created September 30, 2019 14:42 — forked from jpillora/sshd.go
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@jwreagor
jwreagor / cds-ui.nginxconf
Last active August 19, 2019 19:51
Nginx configuration for fronting OVH CDS UI
server {
listen 80;
listen [::]:80;
root /opt/cds/dist;
index index.html;
location /assets/worker/cdsapi/events {
gzip_static off;
}
@jwreagor
jwreagor / backoff.go
Last active December 9, 2018 18:07
Backoff Reference/Example
package main
import (
"context"
"errors"
"fmt"
"os"
"time"
"github.com/cenkalti/backoff"
$ openssl x509 -in .keys/crdb/ca.crt -noout -text
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
d0:69:a6:a0:b6:b8:9e:b5:cf:62:98:2e:b7:7d:9e:15
Signature Algorithm: sha256WithRSAEncryption
Issuer: O=Cockroach, CN=Cockroach CA
Validity
Not Before: Jul 24 18:54:32 2018 GMT
openssl genrsa -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt -subj "/C=US/ST=Washington/L=Seattle/O=Test/OU=Test/CN=localhost:8888"
openssl genrsa -out server.key 4096
openssl req -new -sha256 -key server.key -out server.csr -subj "/C=US/ST=Washington/L=Seattle/O=Test/OU=Server/CN=stackable.dev" -reqexts SAN -config <(cat /etc/ssl/openssl.cnf <(printf "[SAN]\nsubjectAltName=DNS:localhost,DNS:127.0.0.1,DNS:*.stackable.dev,DNS:stackable.dev"))
# openssl req -new -sha256 -key server.key -out server.csr -subj "/C=US/ST=Washington/L=Seattle/O=Test/OU=Server/CN=localhost:8888"
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt
openssl rsa -in server.key -out server.key
openssl genrsa -out client.key 4096
root@ctl-1:~# nomad status
ID Type Priority Status Submit Date
vm1_0a4621ec-d40c-d8cc-0b5d-582d009ce725 service 50 pending 2018-05-07T19:17:33Z
root@ctl-1:~# nomad status
ID Type Priority Status Submit Date
vm1_0a4621ec-d40c-d8cc-0b5d-582d009ce725 service 50 pending 2018-05-07T19:17:33Z
root@ctl-1:~# nomad status vm1_0a4621ec-d40c-d8cc-0b5d-582d009ce725
ID = vm1_0a4621ec-d40c-d8cc-0b5d-582d009ce725
Name = vm1_0a4621ec-d40c-d8cc-0b5d-582d009ce725
Submit Date = 2018-05-07T19:17:33Z
provider "triton" {
insecure_skip_tls_verify = true
}
data "triton_network" "public" {
name = "Joyent-SDC-Public"
}
data "triton_image" "lts" {
name = "base-64-lts"
### Keybase proof
I hereby claim:
* I am cheaproc on github.
* I am justinwr (https://keybase.io/justinwr) on keybase.
* I have a public key ASCBgOUBdHRlOfPDdem4t-uIpX8uV1JRhY1w1URz02q95Qo
To claim this, I am signing this object:
provider "triton" {
insecure_skip_tls_verify = true
}
data "triton_network" "public" {
name = "Joyent-SDC-Public"
}
data "triton_image" "lts" {
name = "base-64-lts"