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
import urllib.request | |
for year in range(1986,2019): | |
file = "COTAHIST_A%i.zip" % year | |
url = 'http://bvmf.bmfbovespa.com.br/InstDados/SerHist/%s' % file | |
urllib.request.urlretrieve(url, "/home/username/Dowloads/%s" % file ) |
#!/usr/bin/env python | |
import socket, time | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(('localhost', 6379)) | |
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) | |
time.sleep(2) | |
sock.sendall('PING\r\n') | |
print repr(sock.recv(4096)) | |
time.sleep(2) |
Requires
Configure path to your ECS SSH key file ~/.bashrc
echo 'export ECS_PEM_FILE=$HOME/docker.pem' >> ~/.bashrc
import logging | |
import time | |
filename="/tmp/profile.log" | |
class timer(): | |
def __init__(self, context=""): | |
''' | |
Profiler for small pieces of code. | |
#!/usr/bin/env python3 | |
from datetime import datetime | |
from json import loads | |
from urllib.request import urlopen | |
request = urlopen('https://api.cotacoes.uol.com/currency/intraday/list?currency=1&fields=bidvalue,date').read() | |
price = loads(request)['docs'][0] | |
price['date'] = datetime.strptime(price['date'], '%Y%m%d%H%M%S').strftime('%d/%m/%Y às %H:%M:%S') | |
if __name__ == '__main__': |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="keywords" content="remark,remarkjs,markdown,slideshow,presentation" /> | |
<meta name="description" content="A simple, in-browser, markdown-driven slideshow tool." /> | |
<title>Docker - Introdução e boas práticas</title> | |
<style> | |
@import url(https://fonts.googleapis.com/css?family=Droid+Serif); | |
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="keywords" content="remark,remarkjs,markdown,slideshow,presentation" /> | |
<meta name="description" content="A simple, in-browser, markdown-driven slideshow tool." /> | |
<title>Arquitetura de Aplicação para Microserviços</title> | |
<style> | |
@import url(https://fonts.googleapis.com/css?family=Droid+Serif); | |
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); |
git show-ref | awk '{print $2}' | xargs -I '{}' git log -n 1 --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit '{}' |
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 |