Instantly share code, notes, and snippets.

View debian_install_docker.sh
#!/bin/bash
# https://docs.docker.com/install/linux/docker-ce/debian/#install-docker-ce-1
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
View Dockerfile
FROM elixir
# install Node.js (>= 8.0.0) and NPM in order to satisfy brunch.io dependencies # See https://hexdocs.pm/phoenix/installation.html#node-js-5-0-0
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y inotify-tools nodejs
WORKDIR /code
RUN useradd -c 'phoenix user' -m -d /home/pho -s /bin/bash pho && \
chown -R pho.pho /code
USER pho
View commit-msg
#!/bin/bash
MSG="$1"
if ! egrep -qE "#[0-9]+" "$MSG";then
cat "$MSG"
echo "Your commit message must contain some issue reference '#...'"
exit 1
fi
View plug.js
function Conn () {
this.continue = true;
this.error = 0;
this.resp_body = {};
}
Conn.prototype.halt = function (error) {
this.error = error || 1;
this.continue = false;
}
View neovim-centos-6.sh
#!/bin/bash
set -e
set -v
# Prerequisites
sudo yum -y install libtool autoconf automake cmake gcc gcc-c++ make pkgconfig unzip gettext
# Installation Folder
mkdir -p ~/opt/src
cd ~/opt/src
# Source
[ -e neovim ] || git clone https://github.com/neovim/neovim.git
View logging_env.py
import logging
LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper()
logging.basicConfig(level=LOGLEVEL)
View Dockerfile
FROM elixir
RUN mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
# install the Phoenix Mix archive
RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phx_new.ez
RUN mix local.hex --force \
&& mix local.rebar --force
# install Node.js (>= 8.0.0) and NPM in order to satisfy brunch.io dependencies # See https://hexdocs.pm/phoenix/installation.html#node-js-5-0-0
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y inotify-tools nodejs
View main.go
package main
import (
"errors"
"fmt"
"log"
"math/rand"
"net/http"
)
View main.go
package main
import (
"log"
"net/http"
)
type handlers struct{}
func (h *handlers) Middleware(next http.HandlerFunc) http.HandlerFunc {
View state.js
let createContext = function(firstState) {
let context = {
count: 100,
next: firstState,
};
return function(message) {
context = context.next(message, context);
return context;
};
};