Skip to content

Instantly share code, notes, and snippets.

View jurby's full-sized avatar

Jaroslav Urbánek jurby

View GitHub Profile

Docker Swarm with Macvlan, Consul and Autoscaling

TL;DR:

This will get you routable containers with IPs on your existing subnets, advertising to Consul. They will also be scalable and placed across a cluster of Swarm hosts. It's assumed that you are already running Consul, so if not, there are a ton of tutorials out there. It's also assumed you know how to install Docker and various Linux kernels.

Bonus: We add an autoscaling API called Orbiter (https://gianarb.it/blog/orbiter-the-swarm-autoscaler-moves).

I just want to run containers, like now, on my existing infrastructure and networks!

So you have an existing environment. You use Consul for service discovery. Life is good. Containers are now a thing and you want to work them in without having to worry about overlay networking or reverse proxies. You also don't want to add extra latency (as some naysayers could use it as fuel to kill your hopes and dreams). Lastly, you don't have a lot of time to invest in a complex orchestration tool, such a

@delfrrr
delfrrr / background.js
Created January 31, 2017 08:34
react-native requestAnimationFrame and d3-interpolate
//this is an example of background animation from my weather comparsion app
//you can get early build of app at http://zowni.com
//full source of background.js below
const React = require('react');
const Svg = React.createFactory(require('react-native-svg').Svg);
const {interpolate} = require('d3-interpolate');
//...
/**
@atoa
atoa / docker-mount.sh
Last active September 10, 2019 13:36
#!/usr/bin/env bash
# Docker for Windows drive mount helper
# Manually mounts a Windows shared drive inside the MobyLinuxVM virtual machine
# (host running on HyperV) so that it is visible to Docker containers.
# It enters the moby VM using nsenter via the 'docker4w/nsenter-dockerd'
# container.
# Then mounts the share drive using the DockerNAT ip address
# This can be useful with unix like environments under Windows
@wallyqs
wallyqs / Docker Compose + NATS example
Last active February 18, 2024 22:27
NATS Docker blog post/HTTP Server
FROM golang:1.6.2
COPY . /go
RUN go get github.com/nats-io/nats
RUN go build api-server.go
EXPOSE 8080
ENTRYPOINT ["/go/api-server"]
#r "Newtonsoft.Json"
#r "System.Configuration"
#r "Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
using System.Net;
using System.Configuration;
using System.Security.Claims;
using System.Net.Http.Headers;
using Newtonsoft.Json;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
@danawoodman
danawoodman / 1-react-websockets-reflux.md
Last active August 21, 2024 20:58
Using WebSockets with Reflux and React

WebSockets + Reflux + React

Using WebSockets, React and Reflux together can be a beautiful thing, but the intial setup can be a bit of a pain. The below examples attempt to offer one (arguably enjoyable) way to use these tools together.

Overview

This trifect works well if you think of things like so:

  1. Reflux Store: The store fetches, updates and persists data. A store can be a list of items or a single item. Most of the times you reach for this.state in react should instead live within stores. Stores can listen to other stores as well as to events being fired.
  2. Reflux Actions: Actions are triggered by components when the component wants to change the state of the store. A store listens to actions and can listen to more than one set of actions.

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@randyburden
randyburden / PdfSharpExtensions.cs
Created November 2, 2014 21:30
PdfSharp extensions for adding a 2D DataMatrix barcode to a PdfPage using the IEC16022Sharp library to generate the 2D barcode image.
namespace PDFMerger.Utilities
{
/// <summary>
/// Provides extension methods for PdfSharp objects.
/// </summary>
public static class PdfSharpExtensions
{
/// <summary>
/// Adds a 2D DataMatrix barcode to the PdfPage.
/// </summary>
@staltz
staltz / introrx.md
Last active July 31, 2025 06:33
The introduction to Reactive Programming you've been missing
@0xF1o
0xF1o / ssh.cs
Last active July 21, 2025 21:06
ssh.net Example - Keybased Authentication, File Upload, Shell Commands
/*
get SSH.NET (BSD License: http://sshnet.codeplex.com/license)
with NuGet:
>Install-Package SSH.NET -Version 2013.4.7
or just get the dll from here: http://j.mp/sshNet
*/
using System;