Skip to content

Instantly share code, notes, and snippets.

View marians's full-sized avatar

Marian Steinbach marians

View GitHub Profile
@marians
marians / Dockerfile
Last active August 29, 2015 14:16
Writing to a Giant Swarm volume from a jenkins container
FROM jenkins:latest
COPY test.sh /test.sh
ENTRYPOINT ["/bin/bash", "/test.sh"]
@marians
marians / Why_Ghost_with_CouchDB.md
Last active August 29, 2015 14:16
Why Ghost with CouchDB?

Dear Hannah Wolfe,

in your tweet you say you'd like to know why we need a database cluster for our blog. Thanks for that question, I'm happy to respond.

Every now and then, every piece of hardware fails. That's why we employ clusters for every server app we are running and go to length to avoid single points or failure.

Our cluster is built on the idea of immutable infrastructure. Our apps run inside Docker containers. When a node in our cluster fails, the containers running on that node are started on a different node. In the meantime, identical instances of the apps running on other machines handle the requests.

This principle is common for stateless applications, but we also want it to be valid for databases. To avoid having a database server be a single point of failure, databases must be run on clusters which share parts of their data.

@marians
marians / Dockerfile
Created May 12, 2015 14:47
Giant Swarm Websocket example
FROM python:2.7-slim
ENV DEBIAN_FRONTEND noninteractive
RUN set -x \
&& apt-get -q update \
&& apt-get install -yq --no-install-recommends git-core build-essential \
&& pip install cython \
&& pip install git+https://github.com/gevent/gevent.git#egg=gevent \
&& pip install Flask \
@marians
marians / main.go
Last active August 29, 2015 14:24
Some colored terminal output using mgutz/ansi
package main
import (
"fmt"
"github.com/mgutz/ansi"
"github.com/ryanuber/columnize"
)
func main() {
config := columnize.DefaultConfig()
@marians
marians / Question.md
Last active September 3, 2015 16:27
A question to Giant Swarm users regarding updating a service definition

Dear users,

we have an important question for you regarding the improvement of one aspect of our product.

When you create a service on Giant Swarm using the service definition (usually in a swarm.json file), after creation of the service you currently can't modify your service.

We know that many of you want this to change. The question is, how would you like this to work?

1) Submitting new swarm.json

@marians
marians / CouchDB_Python.md
Last active January 15, 2026 01:46
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@marians
marians / map.js
Created March 16, 2016 13:16
CouchDB reduce_overflow_error problem
function(doc) {
if (doc.request_context.user_name
&& doc.timestamp
&& doc.day
&& doc.request_context.activity
&& typeof doc.request_context.activity !== "undefined") {
var is_error = 0;
if (typeof doc.response_status !== "undefined" && doc.response_status > 400) {
is_error = 1;
}
@marians
marians / Dockerfile
Last active March 29, 2016 11:14
A Dockerfile for CouchDB
# Taking some inspiration from
# https://github.com/tutumcloud/tutum-docker-couchdb (licensed Apache 2.0)
FROM debian:wheezy
ENV DEBIAN_FRONTEND noninteractive
ENV COUCHDB_VERSION 1.6.1
# install base packages
RUN set -x && \

Getting Started with a D1 mini (ESP-8266EX) and Arduino

These notes from June 2016 document how I got a successful start with a Wemos D1 mini on Arduino (Mac).

Installation

USB Serial Connection

I'm on Mac OS Sierra, so I need a driver for the USB serial bridge on the board, which is a CH340. The driver can be downloaded from this page:

@marians
marians / Dockerfile
Last active July 12, 2016 13:56
Synchronous encryption in Python+PyCrypto for decryption using OpenSSL
FROM python:2.7-alpine
ENV PYTHONUNBUFFERED True
RUN apk add --update openssl py-pip build-base python-dev \
&& pip install pycrypto \
&& apk del build-base python-dev \
&& rm -rf /var/cache/apk/*
ADD . /app/