Skip to content

Instantly share code, notes, and snippets.

View DrEsteban's full-sized avatar

Steven Ryland DrEsteban

View GitHub Profile
@DrEsteban
DrEsteban / .gitattributes
Last active June 21, 2024 00:02
PSA: *Always* add a .gitignore to your repos! Cross-platform developers will thank you.
* text=auto
# Make sure bash scripts get checked out with correct line endings
*.sh text eol=lf
/// <summary>
/// Returns an enumerable that excludes elements from the second enumerable where the key selectors produce a match
/// </summary>
public static IEnumerable<X> Except<X, Y, Z>(this IEnumerable<X> first, IEnumerable<Y> second, Func<X, Z> firstSelector, Func<Y, Z> secondSelector, IEqualityComparer<Z> equalityComparer = null)
{
    ILookup<Z, Y> secondLookup;
    if (equalityComparer == null)
    {
        secondLookup = second.ToLookup(s => secondSelector(s));
@DrEsteban
DrEsteban / marathon_resource_contention.md
Last active February 27, 2017 23:54
DC/OS + Marathon Deployment Issues

DC/OS + Marathon Resource Contention

Introduction

Without developer intervention, machine resources in a DC/OS environment are finite. Each containerized service in a DC/OS + Marathon cluster needs a certain amount of resources in order to run properly. As more and more services are deployed to a cluster, resource contention becomes a real concern. Eventually, resources will become so scarse that services will fail to deploy/scale at all! This is true for any microservice environment.

This Gist will show you how to identify Marathon services that are likely resource-starved, and provides some common steps for resolving this state.

Prerequisites

@DrEsteban
DrEsteban / dc-os_dockercleanup.md
Created January 27, 2017 20:17
DC/OS: Docker artifact cleanup -- What to do if your nodes run out of disk space?

DC/OS: Docker artifact cleanup

Introduction

During the course of normal usage, your DC/OS cluster may accumulate Docker images and containers on the public and private agents. (Especially if you run CI workflows for Docker images in your cluster, or your microservices are frequently spinning up & down with new container instances.) By default, Docker caches each image version and container instance on the executing node so it can quickly rehydrate stopped containers or deploy new instances. Eventually this process will fill the entire disk.

This Gist will walk you through the process of cleaning out these cached images/containers from your public and private agents, using a specially-configured Marathon app.

Prerequisites

  • You'll need the private SSH key corresponding to the public key that is authorized with your DC/OS cluster.
@DrEsteban
DrEsteban / README.md
Created January 26, 2017 04:30 — forked from trieloff/README.md
A command line alternative to LampStealer

The LampStealer app for Hue does not work with newer versions of the bridge, as the API has changed. This shell script works with fewer dependencies and achieves the same. Install jq and run the shell script after pushing the big button on the bridge.