Skip to content

Instantly share code, notes, and snippets.

View saml's full-sized avatar

Sam Lee saml

  • New York, NY
View GitHub Profile
14:23:47.431567 recvfrom(5, "\27\247\201\200\0\1\0\1\0\0\0\0\6google\3com\0\0\1\0\1\300\f\0\1"..., 2048, 0, {sa_family=AF
_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.16.6")}, [28->16]) = 44
14:23:47.431997 poll([{fd=5, events=POLLIN}], 1, 4867) = 0 (Timeout)
14:23:52.304681 poll([{fd=5, events=POLLOUT}], 1, 0) = 1 ([{fd=5, revents=POLLOUT}])
14:23:52.305280 sendto(5, "\27\247\1\0\0\1\0\0\0\0\0\0\6google\3com\0\0\1\0\1", 28, MSG_NOSIGNAL, NULL, 0) = 28
14:23:52.305969 poll([{fd=5, events=POLLIN}], 1, 5000) = 1 ([{fd=5, revents=POLLIN}])
14:23:52.309883 ioctl(5, FIONREAD, [44]) = 0
#!/bin/sh
if [ $# -gt 0 ]
then
cmd="$@"
else
cmd='pytest -m "not slow" -n 8 tests/ --api http://localhost:8080'
fi
python wait_for_apps.py && $cmd
monorepo/
  lib/
  app1/
    Dockerfile
    docker-compose.yaml

How can I COPY lib/ to app1 container when I want to set context to . for app1? Is Makefile running docker build the only way? No docker-compose way?

monorepo/
        app-dir/
                apppkg/__init__.py
        lib-dir/
                src/
                        libpkg/__init__.py

Working directory is: monorepo/app-dir/

nginx:
pkg:
- installed
service.running:
- watch:
- file: /etc/nginx/nginx.conf
- cmd: /etc/nginx/cloudfront.conf
/etc/aws/ip-ranges.json:
file.managed:

First, start toxiproxy (https://github.com/Shopify/toxiproxy):

toxiproxy-server
toxiproxy-cli create rabbitmq --listen localhost:5670 --upstream localhost:5672

RabbitMQ listens 5672. Toxiproxy listens 5670.

Prepare helper functions that connect to the proxy with short timeouts:

$ tree
.
├── bar
│   └── a
│   ├── c.py
│   └── __init__.py
└── foo
└── a
├── b.py
└── __init__.py
# -*- coding:utf-8 -*-
"""
Demonstrating problem with pyfakefs==3.5.8 with multiprocessing:
1. In Python 3, multiprocessing tries to close a pipe,
which isn't supported by pyfakefs.
2. In Python 2 (and probably Python 3 as well), pyfakefs patcher isn't
applied to the forked Python process.
"""
@saml
saml / noxfile.py
Created February 7, 2019 16:58
nox and posargs where it starts with --
import argparse
import nox
@nox.session(python=['2.7', '3.6'])
def tests(session):
parser = argparse.ArgumentParser()
parser.add_argument('--notest', action='store_true', default=False, help='Install dependencies. But do not run test.')
parser.add_argument('args', nargs=argparse.REMAINDER)
args = parser.parse_args(session.posargs)
@saml
saml / yolo.tf
Last active January 17, 2019 15:05
# metric_monitor.tf
resource "datadog_monitor" "metric_monitor" {
name = "${var.title}"
type = "metric alert"
query = "${var.query}"
message = "${var.message}"
}
# yolo.tf
module "yolo_monitor" {