Requires
- aws-cli - https://aws.amazon.com/cli/
- jq - https://stedolan.github.io/jq/
Configure path to your ECS SSH key file ~/.bashrc
echo 'export ECS_PEM_FILE=$HOME/docker.pem' >> ~/.bashrc
Requires
Configure path to your ECS SSH key file ~/.bashrc
echo 'export ECS_PEM_FILE=$HOME/docker.pem' >> ~/.bashrc
docker stats --no-stream --format "{\"container\": \"{{ .Container }}\", \"memory\": { \"raw\": \"{{ .MemUsage }}\", \"percent\": \"{{ .MemPerc }}\"}, \"cpu\": \"{{ .CPUPerc }}\"}"
docker stats --no-stream --format "{\"container\": \"{{ .Container }}\", \"name\": \"{{ .Name }}\", \"memory\": { \"raw\": \"{{ .MemUsage }}\", \"percent\": \"{{ .MemPerc }}\"}, \"cpu\": \"{{ .CPUPerc }}\"}###" | sed "s/}###/, \"date\": $(date \"+%d\/%m\/%Y %H:%M\")},/g" >> /home/mauro/docker_homolog_status.json
| # Add the following 'help' target to your Makefile | |
| # And add help text after each target name starting with '\#\#' | |
| help: ## Show this help. | |
| @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | |
| # Everything below is an example | |
| target00: ## This message will show up when typing 'make help' | |
| @echo does nothing |
| FROM python:2.7-alpine | |
| MAINTAINER Nick Janetakis <[email protected]> | |
| ENV INSTALL_PATH /bsawf | |
| RUN mkdir -p $INSTALL_PATH | |
| WORKDIR $INSTALL_PATH | |
| COPY requirements.txt requirements.txt | |
| RUN apk add --no-cache --virtual .build-deps \ |
| # script to download up to <= 3200 (the official API limit) of most recent tweets from a user's timeline | |
| from pymongo import MongoClient | |
| import tweepy | |
| import json | |
| #Twitter API credentials | |
| CONSUMER_KEY = '' | |
| CONSUMER_SECRET = '' | |
| ACCESS_TOKEN = '' |
| import java.util.LinkedHashMap; | |
| import java.util.Map; | |
| import java.util.Stack; | |
| public class BracketsUtils { | |
| private static final char OPENING_BRACKET = '['; | |
| private static final char CLOSING_BRACKET = ']'; | |
| public static int findClosingBracket(String text, int openingBracketIndex) { |
| # coding: utf-8 | |
| class EmptyClass(object): | |
| def __repr__(self): | |
| return "" | |
| Empty = EmptyClass() | |
| class Node(object): | |
| def __init__(self, value, key=None): |
| def bubble(l_elems, is_sorted, step): | |
| if step is 1 or is_sorted: | |
| # base case: l_elems is already sorted or we pass through the list len(l_elems) times | |
| return l_elems | |
| else: | |
| is_swapped = False | |
| for i in range(len(l_elems) - 1): | |
| # compares each pair of adjacent items and swaps them if they are in the wrong order | |
| if l_elems[i] > l_elems[i + 1]: | |
| is_swapped = True |
| """ | |
| this has a lot of list / tuple casting, and doesn't use | |
| native python list properties to full advantage. | |
| It mimics Little Schemer style coding quite well though. | |
| """ | |
| import itertools |
| from datetime import datetime | |
| class LRUCacheItem(object): | |
| """Data structure of items stored in cache""" | |
| def __init__(self, key, item): | |
| self.key = key | |
| self.item = item | |
| self.timestamp = datetime.now() |