Skip to content

Instantly share code, notes, and snippets.

View zeisss's full-sized avatar
🍪
Eat More Chocolate Cookies!

Stephan zeisss

🍪
Eat More Chocolate Cookies!
View GitHub Profile
#!/bin/sh
# btsync service
# Replace with linux users you want to run BTSync clients for
BTSYNC_USERS="zeisss"
DAEMON=/usr/bin/btsync
start() {
for btsuser in $BTSYNC_USERS; do
HOMEDIR=`getent passwd $btsuser | cut -d: -f6`
config=$HOMEDIR/.sync/config.json

Unionize: network superpowers for your docker containers

Unionize lets you connect together docker containers in arbitrarily complex scenarios.

Just check those examples.

LAMP stack with a private network between the MySQL and Apache containers

Let's create two containers, running the web tier and the database tier:

-module(echo_server).
-compile(export_all).
%%% === Public API
start_link() ->
spawn_link(fun() -> ok = init(), loop() end).
echo(Node, Message) ->
echo(Node, Message, 5000).
@zeisss
zeisss / editor.erl
Last active December 22, 2015 01:39
State transformation of one string to another
-module(editor).
-include_lib("eunit/include/eunit.hrl").
-export([edit/2, edits/2]).
-type command() :: delete | {add, char()} | {insert, char()} |
skip | {replace, char()}.
%% Applies the list of commands to the given Input string and returns the resulting
{application, <App Name>,
[{description, "<App Description>"},
{vsn, "<App Version>"},
{modules, [<Module List>]},
{registered, [<Registered Modules]},
{applications, [<Dependency List>]},
{mod, {<Application Behaviour Module>, []}}]}.
# -*- mode: ruby -*-
# vi: set ft=ruby :
BOX_NAME = ENV['BOX_NAME'] || "ubuntu"
BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise64.box"
VF_BOX_URI = ENV['BOX_URI'] || "http://files.vagrantup.com/precise64_vmware_fusion.box"
AWS_REGION = ENV['AWS_REGION'] || "us-east-1"
AWS_AMI = ENV['AWS_AMI'] || "ami-d0f89fb9"
FORWARD_DOCKER_PORTS = ENV['FORWARD_DOCKER_PORTS']
// {"id": 1, "method": "echo2.Echo", "params": ["hello", "world"]}
package main
import (
"log"
"fmt"
"net"
"net/rpc"
"net/rpc/jsonrpc"
)
type Args struct {
Values []string `json:values`
}
type Service int
// {"id": 1, "method": "echo2.Echo2", "params": {"values": ["hello", "world"]}}
func (this *Service) Echo2(params *Args, response *string) error {
*response = "Hello World"
return nil
@zeisss
zeisss / update_somafm_playlists.sh
Last active December 26, 2015 11:19
Updates somafm m3u playlists files in the current folder
#!/bin/sh
# Create the interested streams by touching:
# $ touch somafm_groovesalad.m3u
# $ touch somafm_covers.m3u
for x in somafm_*.m3u
do
PLAYLIST_FILE=$x
STREAM=$(echo $PLAYLIST_FILE | sed -e 's/^somafm_//' -e 's/\.m3u$//')
echo Checking $STREAM
$ ./etcd -v -f -data-dir /var/lib/etcd -bind-addr 0.0.0.0 -addr 192.168.53.2:4001 -peer-addr 192.168.53.2:7001 -peer-bind-addr 0.0.0.0 -discovery https://discovery.etcd.io/86bf5ce860eef35b94f9f616fb55964f -name dockzero-01
[etcd] Mar 10 10:19:40.979 DEBUG | open /var/lib/etcd/snapshot: permission denied
[etcd] Mar 10 10:19:40.982 INFO | Discovery via https://discovery.etcd.io using prefix /86bf5ce860eef35b94f9f616fb55964f.
[etcd] Mar 10 10:19:42.081 INFO | Discovery _state was empty, so this machine is the initial leader.
[etcd] Mar 10 10:19:42.081 INFO | Discovery fetched back peer list: []
[etcd] Mar 10 10:19:42.081 DEBUG | This peer is starting a brand new cluster based on discover URL.