Skip to content

Instantly share code, notes, and snippets.

@cgarnier
cgarnier / docker-compose.yml
Last active November 5, 2018 05:30
docker compose file for a docker registry
registry:
image: registry:2
restart: always
ports:
- 5000:5000
volumes:
- ./data:/var/lib/registry
- ./certs:/certs
- ./auth:/auth
environment:
@cgarnier
cgarnier / docker0.sh
Created November 30, 2015 14:05
Create a docker bridge
sudo brctl addbr docker0
sudo ip addr add 192.168.55.1/24 dev docker0
sudo ip link set dev docker0 up
@cgarnier
cgarnier / create-startssl-cert-bundle.sh
Created December 1, 2015 14:59 — forked from david50407/create-startssl-cert-bundle.sh
Read a SSL certificate issued by StartSSL and bundle intermediate certificates into it so it works everywhere
#!/bin/bash
set -eo pipefail
cert_file="$1"
if [ -z "$cert_file" ]; then
echo "Usage: create-startssl-cert-bundle CERTIFICATE_FILE" >&2
echo >&2
echo "Bundles StartSSL's intermediate certs and writes combined certificate to stdout" >&2
exit 1
@cgarnier
cgarnier / docker.domain.tld
Created December 5, 2015 10:16
nginx proxy conf for docker registry
server {
listen 443;
server_name docker.domain.tld;
client_max_body_size 1G;
ssl on;
ssl_certificate /path/to/certs/registry.bundle.crt;
ssl_certificate_key /path/to/certs/registry.key;
location / {
@cgarnier
cgarnier / deploy.sh
Created March 6, 2016 13:17
Deploy a git project with gitlab ci.
#!/bin/bash
# Install ssh-agent if not already installed, it is required by Docker.
# (change apt-get to yum if you use a CentOS-based image)
which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
# Run ssh-agent (inside the build environment)
eval $(ssh-agent -s)
@cgarnier
cgarnier / Gitlab docker-compose.yml
Created June 13, 2016 20:48
A docker compose file for gitlab server
postgresql:
restart: always
image: sameersbn/postgresql:9.4-10
environment:
- DB_USER=gitlab
- DB_PASS=***changeme***
- DB_NAME=gitlabhq_production
volumes:
- /srv/docker/gitlab/postgresql:/var/lib/postgresql
gitlab:
@cgarnier
cgarnier / node6_on_raspbian.md
Last active May 1, 2019 20:26
Install node 6 on raspbian
@cgarnier
cgarnier / post-receive
Last active June 19, 2016 17:47 — forked from edmondburnett/gist:40e7db34416fdc734846
Push-to-Deploy node project
#!/usr/bin/env python
# post-receive hook for git-based deployments
import sys
import os
from subprocess import call
# configuration
deploy_to_path = os.path.realpath('./deploy_dir')
deploy_branch = 'master'
@cgarnier
cgarnier / prepare-commit-msg
Last active June 5, 2017 05:36 — forked from airblade/prepare-commit-msg
Git prepare-commit-msg hook to extract issue number from branch name and append to commit message.
#!/bin/bash
# Adds reference to GitHub issue if available in branch name.
# The issue number should be at the end of the branch name, following
# a hyphen.
# Only proceed if no second parameter is given to the script.
if [ x = x${2} ]; then
branch=$(git symbolic-ref --short HEAD)
if [[ $branch =~ ^([^/]+)/([A-Z]+\-[0-9]+) ]]; then
@cgarnier
cgarnier / TweenMax dashed svg path animation.js
Last active October 5, 2016 09:52
Animate a svg path with TweenMax
/**
* Animate a dashed svg path
* @param el DOM path element
* @param width Width of the dashes
* @param space Space between the dashes
*/
animateLine (el, width, space) {
let total = Math.floor(el.getTotalLength())
let segment = [width, space]