Skip to content

Instantly share code, notes, and snippets.

View mrsimonemms's full-sized avatar
🐝
Tinkerin'

Simon Emms mrsimonemms

🐝
Tinkerin'
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mrsimonemms on github.
  • I am mrsimonemms (https://keybase.io/mrsimonemms) on keybase.
  • I have a public key ASDWmVzBQL-wc2XXO0HEwvP2uCHQ2S-kfRgc_irSpRpsawo

To claim this, I am signing this object:

@mrsimonemms
mrsimonemms / app.js
Last active June 28, 2017 12:22
Socket IO
const io = require('socket.io-client');
const socket = io('http://example.com/room/name');
socket
.on('connect', (...args) => {
// Do something on connection
})
.on('event1', (...args) => {
// Do something when an event is received
@mrsimonemms
mrsimonemms / docker-compose.yml
Created April 13, 2017 15:24
Docker Compose Swarm
###
# run command: docker stack deploy -c docker-compose.yml dockercoins
###
version: "3"
services:
rng:
image: riggerthegeek/rng
ports:
@mrsimonemms
mrsimonemms / domain.sh
Created April 12, 2017 13:37 — forked from leanderjanssen/domain.sh
Create Registry Server certificate
#!/bin/bash
# Retrieve public and private ip of instance
PUBLIC_HOSTNAME=$(curl -s http://169.254.169.254/latest/meta-data/public-hostname)
PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
PRIVATE_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
# Generate openssl config for self-signed certificate with SANs
cat << EOF > ~/domain.cnf
[ ca ]
@mrsimonemms
mrsimonemms / cert.sh
Created April 12, 2017 10:11 — forked from leanderjanssen/cert.sh
Create Docker certificates
#!/bin/bash
# Retrieve public and private ip of instance
PUBLIC_IP=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
PRIVATE_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
mkdir ~/docker-ca
chmod 0700 ~/docker-ca
cd ~/docker-ca || exit 1
@mrsimonemms
mrsimonemms / docker-labels.md
Created April 12, 2017 08:36 — forked from leanderjanssen/docker-labels.md
Example of a Dockerfile with LABEL and ARG

Example of using LABEL and ARG in a Dockerfile

Dockerfile

FROM ubuntu:14.04
RUN apt-get -y update
RUN apt-get -y install vim
RUN apt-get -y install curl
ARG GIT_COMMIT=unknown
LABEL git-commit=$GIT_COMMIT
@mrsimonemms
mrsimonemms / dropbox.sh
Created November 1, 2016 11:54
CLI Save to Dropbox
## Add to crontab -e with "/bin/bash /root/DropboxBackup.sh"
## Taken from http://davehope.co.uk/Blog/backup-your-linux-vps-to-dropbox/
#!/bin/bash
DROPBOX_USER="Your Dropbox username"
DROPBOX_PASS="Your Dropbox password"
DROPBOX_DIR="Directory in your dropbox account to store the backups, e.g. /backups"
BACKUP_SRC="/home /var/www /var/git /etc /root"
BACKUP_DST="/tmp"
MYSQL_SERVER="127.0.0.1"
@mrsimonemms
mrsimonemms / replaceEnvvars.ts
Created August 16, 2016 11:07
Envvar replace
/**
* Replace Env Vars
*
* Looks for a matching environment variable and
* puts it into the object
*/
"use strict";
@mrsimonemms
mrsimonemms / Dockerfile
Last active August 11, 2016 07:51
SPA hosting script
########################################
# Docker #
# #
# An Nginx container that enables the #
# application to run #
########################################
# Run with
# docker build -t nginx/server .
# docker run -it --rm --name web -p 7777:9999 nginx/server
@mrsimonemms
mrsimonemms / app.js
Created July 20, 2016 20:01
supertest
import restify from "restify";
const app = restify.createServer({
name: 'MyApp',
});
app.listen(8080);
export {app};