| #!/bin/bash | |
| CONTENT="$1" | |
| # Create a random file name for tmp files | |
| RAND=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 32) | |
| TMPFILE="/tmp/$RAND" | |
| # Render content to tmp file and output content | |
| echo -e "$CONTENT" > "$TMPFILE.in" |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
| # How to encrypt/decrypt your text/blob secret with AWS KMS with AWS cli | |
| KEY_ID=alias/my-key | |
| SECRET_BLOB_PATH=fileb://my-secret-blob | |
| SECRET_TEXT="my secret text" | |
| ENCRYPTED_SECRET_AS_BLOB=encrypted_secret_blob | |
| DECRYPTED_SECRET_AS_BLOB=decrypted_secret_blob # Result of decrypt-blob target | |
| encrypt-text: |
| #!/usr/bin/env ruby | |
| require 'open3' | |
| require 'json' | |
| ffmpeg_bin = '/usr/local/bin/ffmpeg' | |
| target_il = -24.0 | |
| target_lra = +11.0 | |
| target_tp = -2.0 | |
| samplerate = '48k' |
Release in Chef 12.9.41 via PR #4741 core chef now has a feature which has been available in Poise for awhile, which is that notifications from within resources will now notify resources in outer run contexts. This means you can write a recipe with a service resource and send a notification to it from a resource that you write.
Notifications will bubble up from arbitrarily nested resources, so users that write resources that wrap resources which wrap your resource will still find the service resource in your default recipe.
At the same time the resources collection #find() and #lookup methods and the more commonly-used DSL method resources("service[ntpd]") has been changed to also match
| # Description: How to assign VPC addresses to Docker containers associated as secondary IP addresses to an ENI in AWS | |
| # Operating System: Amazon Linux AMI 2016.09.1 (HVM) | |
| # Prerequisites: | |
| # - Assign N number of secondary IP addresses to network interface on Docker host | |
| # - Each new container requires additional assignment of secondary IP addresses | |
| # - Containers can be launched with --net=none to avoid adding a Docker networked NIC (docker run --net=none -d imageId) | |
| # Credit to https://github.com/jpetazzo/pipework for steps on linking IP address | |
| ################# Setup Bridge of eth0 ###################### | |
| yum install bridge-utils -y |
| version: '2' | |
| services: | |
| myapp: | |
| build: . | |
| container_name: "myapp" | |
| image: debian/latest | |
| environment: | |
| - NODE_ENV=development | |
| - FOO=bar | |
| volumes: |
We are having troubles talking to Mesos DNS if our Marathon application / service has two ports.
We could use mesos consul https://hub.docker.com/r/ciscocloud/mesos-consul/ but that would require a consul cluster.
The following are instructions to install consul on dcos/mesos/coreos. This may not be the best way. Coreos does have a package manager (but we don't know how to use it). At a minimum we should script this with ansible. (We are not ansible experts either).
So far, I have been unable to get mesos-consul to work but consul is running on the mesos-masters and mesos-slaves in a special snowflake fashion.