This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for NAMESPACE in $(kubectl get namespaces -o jsonpath='{.items[*].metadata.name}'); do | |
kubectl -n $NAMESPACE delete job $(kubectl -n $NAMESPACE get jobs -o jsonpath='{.items[?(@.status.completionTime)].metadata.name}') | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def depaginate(initial_url, **kwargs): | |
r = requests.get(initial_url, **kwargs) | |
r.raise_for_status() | |
yield r.json() | |
while r.links.get('next'): | |
r = requests.get(r.links.get('next'), **kwargs) | |
r.raise_for_status() | |
yield r.json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest AS cloudfront | |
RUN apk --no-cache add curl jq | |
RUN curl https://ip-ranges.amazonaws.com/ip-ranges.json | \ | |
jq -r '.prefixes[] | select(.service=="CLOUDFRONT") | .ip_prefix' | \ | |
xargs -I '{}' echo 'set_real_ip_from {};' > /cloudfront.conf && \ | |
echo 'real_ip_header X-Forwarded-For;' >> /cloudfront.conf && \ | |
echo 'real_ip_recursive on;' >> /cloudfront.conf | |
FROM nginx:latest | |
COPY --from=cloudfront /cloudfront.conf /etc/nginx/conf.d/cloudfront.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import importlib | |
from functools import wraps | |
from myproject.celery import app | |
@app.task | |
def call_async_task(obj_module_name, obj_class_name, obj_pk, obj_method, obj_args=None, obj_kwargs=None): | |
model_class = getattr(importlib.import_module(obj_module_name), obj_class_name) | |
obj = model_class.objects.get(pk=obj_pk) | |
method = getattr(obj, obj_method) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Required env vars: | |
# $CLUSTER: name of the ECS cluster (i.e. `myapp-prod`) | |
# $TASK_DEFINITION: name and revision of the task definition (i.e. `mytask:1`) | |
# $SUBNETS: comma-separated list of subnets to place the new task (i.e. `sg-12345678,sg-abcdef12`) | |
# $SECURITY_GROUPS: comma-separated list of security groups to be used for the new task (i.e. `subnet-12345678`) | |
import boto3 | |
import os | |
import traceback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://lobster1234.github.io/2017/12/03/run-tasks-with-aws-fargate-and-lambda/ | |
import boto3 | |
import os | |
def lambda_handler(event,context): | |
client = boto3.client('ecs') | |
response = client.run_task( | |
cluster=os.getenv('CLUSTER'), | |
launchType=os.getenv('LAUNCH_TYPE', 'FARGATE'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import datetime | |
def access_logging(get_response): | |
logger = logging.getLogger("access_logging") | |
def middleware(request): | |
response = get_response(request) | |
log_format = '{remote_addr} - {remote_user} [{time_local}] "{request}" {status} {body_bytes_sent} ' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REPO="dockercloud/client-proxy" | |
alias notary='notary -s https://notary.docker.io -d ~/.docker/trust' | |
# First you need to import the root key for Docker Cloud | |
notary key import 70340602d65cb8b39db81ca680269d93272b0925e279ec171c0f33d165977405.key | |
# Create target key for $REPO | |
notary init docker.io/$REPO | |
notary key rotate docker.io/$REPO snapshot -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lb: | |
image: tutum/haproxy | |
ports: | |
- "80:80" | |
links: | |
- helloworld | |
roles: | |
- global | |
helloworld: | |
image: tutum/hello-world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /usr/src/ixgbevf-2.16.1/src/kcompat.h.orig 2015-02-03 18:34:22.901474028 +0000 | |
+++ /usr/src/ixgbevf-2.16.1/src/kcompat.h 2015-02-03 18:35:32.577440102 +0000 | |
@@ -3219,8 +3219,6 @@ | |
#define u64_stats_update_begin(a) do { } while(0) | |
#define u64_stats_update_end(a) do { } while(0) | |
#define u64_stats_fetch_begin(a) do { } while(0) | |
-#define u64_stats_fetch_retry_bh(a) (0) | |
-#define u64_stats_fetch_begin_bh(a) (0) | |
#if (RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1)) |
NewerOlder