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

#!/usr/bin/perl
# This script concatenates and minifies a given set of CSS and JavaScript files
# so that only one JS and one CSS file are the result.
#
# In order to make it work for your project, configure the path settings and the
# file names both for input and output files.
#
# by Marian Steinbach <marian@sendung.de>
@marians
marians / gist:879241
Created March 21, 2011 09:57
CSV dump from local database
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
This script extracts CSV dumps from my local database
Author: Marian Steinbach, marian@sendung.de, http://www.sendung.de/japan-radiation-open-data/
'''
import csv
@marians
marians / rename.sh
Created July 7, 2011 20:22
Batch renaming files to create a numbered file sequence
#!/bin/bash
# Assuming that you have a number of
# PNGs in a folder pngs/, this script
# will rename them to a file sequence
# like 0001.png, 0002.png, ...
n=0
for f in pngs/*.png; do
n=`expr $n + 1`;
@marians
marians / database.sql
Created July 27, 2011 07:55
Snapshot of the script I wrote to generate http://vimeo.com/26157684
CREATE TABLE `stations` (
`id` varchar(9) COLLATE latin1_general_ci NOT NULL,
`postalcode` varchar(5) COLLATE latin1_general_ci NOT NULL,
`name` varchar(255) COLLATE latin1_general_ci NOT NULL,
`longitude` decimal(5,2) NOT NULL,
`latitude` decimal(5,2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci COMMENT='BfS Sensor Stations';
CREATE TABLE `values_2h` (
@marians
marians / getpostcounts.py
Created January 5, 2012 10:26
de. Newsgroups und Statistiken darüber
#!/usr/bin/env python
# encoding: utf-8
"""
This script acquires statistics on usenet groups.
It first reads a list of groups from a file and then
reads the Google Group info page about that group to
gather monthly post counts.
"""