Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
#!/bin/sh | |
# Copyright 2020 Paul Morgan | |
# License: GPLv2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) | |
set -x | |
set -e | |
# | |
# Docker build calls this script to harden the image during build. | |
# | |
# NOTE: To build on CircleCI, you must take care to keep the `find` | |
# command out of the /proc filesystem to avoid errors like: |
# -*- coding: utf-8 -*- | |
from mpl_finance import candlestick_ohlc | |
import numpy as np | |
from matplotlib import pyplot | |
import pandas as pd | |
from bs4 import BeautifulSoup | |
import urllib.request | |
import re |
__author__ = 'David Manouchehri' | |
from bs4 import BeautifulSoup | |
import urllib.request | |
import gzip | |
import io | |
url = 'http://yoururlgoesherehopefullythisisntavalidurl.com/pages.html' | |
headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', |
AF | 0132 | AFEGANISTÃO | |
---|---|---|---|
AL | 0175 | ALBÂNIA, REPÚBLICA DA | |
DE | 0230 | ALEMANHA | |
BF | 0310 | BURKINA FASO | |
AD | 0370 | ANDORRA | |
AO | 0400 | ANGOLA | |
AI | 0418 | ANGUILLA | |
AG | 0434 | ANTIGUA E BARBUDA | |
0477 | ANTILHAS HOLANDESAS | ||
SA | 0531 | ARÁBIA SAUDITA |
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__': |