Skip to content

Instantly share code, notes, and snippets.

@BenHall
BenHall / jwt.js
Created January 4, 2017 11:40
Json Web Tokens Example
var fs = require('fs');
var jwt = require('jsonwebtoken');
var token = jwt.sign({ foo: 'bar' }, 'blah');
var decoded = jwt.verify(token, 'blah');
console.log("Decodable at https://jwt.io/#debugger", token, decoded.foo); // bar
// invalid token - synchronous
try {
web: # Container Name
build: . # Build
links: # Links
- elasticsearch
ports: # Ports
- 3000
environment: # Environment
VIRTUAL_HOST: ’www.katacoda.com'
NODE_ENV: 'production’
variables:
IMAGE_NAME: https://HOST2_SUBDOMAIN-80-KATACODA_HOST.environments.katacoda.com/root/front-end
TAG: $CI_BUILD_ID
stages:
- build
- push
- cleanup
build_production:
stage: build
script:

TLDR: RSVP at https://www.meetup.com/Docker-London/events/234774339/, make sure you have a Docker Hub account, and bring your laptop fully charged with Docker set-up. See below for some further instructions and details.

Create a Docker Hub account here at https://hub.docker.com. You will need a Docker Hub account to access the course materials.

Set-up Docker on your laptop (you will need to bring your computer): Linux users: we need you to install Docker Engine and Docker compose. Make sure you have Docker compose version 1.6 or higher by running docker-compose version from the command prompt. Mac users: install Docker for Mac or if you have an older Mac, Docker Toolbox.

Windows users: if you have Windows 10 pro install Docker for Windows, otherwise install Docker Toolbox. If you want to try the new Windows containers, go through the setup steps in the Windows Container lab. It is essential to run this command in Powershell before coming to the event:

Given this profile:
```
cat b.json
{
"defaultAction": "SCMP_ACT_ALLOW",
"architectures": [
"SCMP_ARCH_X86_64",
"SCMP_ARCH_X86",
"SCMP_ARCH_X32"
],
@BenHall
BenHall / postgres.service
Last active September 21, 2021 19:34
Docker Systemd Unit File
[Unit]
Description=PostgreSQL container
Requires=docker.service
After=docker.service
[Service]
Restart=on-failure
RestartSec=10
ExecStartPre=-/usr/bin/docker stop postgres
ExecStartPre=-/usr/bin/docker rm postgres
docker create -v /config --name data busybox
touch some.config
docker cp some.config data:/config/
docker run --volumes-from data -it ubuntu bash
@BenHall
BenHall / bash.js
Created January 19, 2016 15:10
Katacoda Embedded Example
<script src="//katacoda.com/embed.js"></script>
<div id="inline-terminal-1" data-katacoda-env="bash" style="height: 500px;"></div>
@BenHall
BenHall / config.json
Last active December 18, 2015 14:27
ContainerD error
{
"version": "0.2.0",
"platform": {
"os": "linux",
"arch": "amd64"
},
"process": {
"terminal": true,
"user": {
"uid": 0,
@BenHall
BenHall / es6-generator.js
Last active November 26, 2015 11:59
JavaScript Generator Example
// Example from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators
function* idMaker(){
var index = 0;
while(true)
yield index++;
}
var gen = idMaker();