Skip to content

Instantly share code, notes, and snippets.

View jmshal's full-sized avatar

Jacob Marshall jmshal

  • New Zealand
View GitHub Profile
@jmshal
jmshal / create-multi-host-swarm-digitalocean.sh
Last active March 16, 2023 13:22
Setup a Docker Swarm multi-host cluster on DigitalOcean
docker-machine create \
--driver=digitalocean \
--digitalocean-access-token=$DO_TOKEN \
--digitalocean-size=512mb \
--digitalocean-region=nyc3 \
--digitalocean-private-networking=true \
--digitalocean-image=ubuntu-15-04-x64 \
docker-swarm-kv-store
docker $(docker-machine config docker-swarm-kv-store) run -d \
@jmshal
jmshal / swarm-with-docker-machine.sh
Created February 11, 2016 22:21 — forked from nishanttotla/swarm-with-docker-machine.sh
A bash script to set up a simple Docker Swarm cluster using Docker Machine
################################## INSTRUCTIONS ##################################
# 1. Make sure docker-machine is installed on your machine #
# 2. Download the file #
# 3. Run using $ . swarm-with-docker-machine.sh so that DOCKER_HOST is exported #
##################################################################################
# Clean any existing machines
yes | docker-machine rm manager
yes | docker-machine rm agent1
yes | docker-machine rm agent2
@jmshal
jmshal / atob.js
Last active December 13, 2022 15:54
Node.js ponyfill for atob and btoa encoding functions
module.exports = function atob(a) {
return new Buffer(a, 'base64').toString('binary');
};
@jmshal
jmshal / golang-tls.md
Created June 21, 2017 08:05 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@jmshal
jmshal / main.go
Created June 11, 2019 22:31 — forked from julz/main.go
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@jmshal
jmshal / main.go
Created June 29, 2017 10:25 — forked from manishtpatel/main.go
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
// Red
$color-red-50: #fde0dc;
$color-red-100: #f9bdbb;
$color-red-200: #f69988;
$color-red-300: #f36c60;
$color-red-400: #e84e40;
$color-red-500: #e51c23;
$color-red-600: #dd191d;
$color-red-700: #d01716;
$color-red-800: #c41411;
@jmshal
jmshal / README.md
Last active May 15, 2018 01:54
Electron `position: sticky` shim

electron-sticky-shim

This 8 line shim makes elements with position: sticky work as intended in situations where you have scrollable content nested within your app - see this for an example.

Installation

You can either copy the sticky-shim.js file from this gist, or install it as a module using npm...

$ npm install --save gist:4c7dd81a61adcb648944a16b0fac717f

#Setting up Docker Machine on Raspberry PI

  1. SSH into the pi and install docker with curl -sSL https://get.docker.com | sh (If we let Machine try to install the Docker daemon it will fail.)
  2. Change the OS's ID so Docker Machine won't throw errors. sudo nano /etc/os-release and change the line that says ID=raspbian to ID=debian
  3. From a new terminal window run docker-machine create --driver generic --generic-ip-address YOUR-PIS-IP --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user pi --engine-storage-driver overlay2 MACHINE-NAME