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 wget, fitz, glob | |
import requests, time | |
from bs4 import BeautifulSoup | |
url='http://www.memoriachilena.gob.cl/602/w3-article-100795.html#documentos' | |
bs = BeautifulSoup(requests.get(url).text, 'lxml') | |
links = [link['href'] for link in bs.find_all('a') | |
if '.pdf' in link.get('href','')] | |
print(len(links)) |
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 openaq | |
import pandas as pd | |
api = openaq.OpenAQ() # fuente: www.openaq.org | |
cdf = api.cities(country='CL', df=True) | |
cdf = cdf[cdf.city.isin(['Quintero','Concón','Puchuncaví'])] | |
xdf = pd.concat([api.measurements(city=city, df=True, limit=1000) | |
for city in cdf.city]) |
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 geopandas as gp | |
import time | |
hdf=gp.read_file('Humedales', encoding='utf-8') | |
hdf.region.value_counts() | |
hdf.cut_reg.value_counts() | |
#hdf.set_crs(epsg=4326, inplace=True) | |
#hdf=hdf.to_crs(epsg=4326) # doesn not work for every region! |
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 tts | |
imagen = read('github/pecos.png') | |
texto = tts(imagen) |
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 cv2, glob | |
import numpy as np | |
fourcc = cv2.VideoWriter_fourcc(*'mp4v') # choose codec according to needed format | |
video = cv2.VideoWriter('video.avi', fourcc, 1, (width, height)) | |
for fn in glob.glob('*.png'): | |
img = cv2.imread(fn) | |
video.write(img) |
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 diagrams import Diagram, Cluster | |
from diagrams.aws.compute import EC2 | |
from diagrams.aws.network import ELB | |
with Diagram("Simple Website Diagram", direction='TB') as diag: | |
API = ELB("API") | |
piton = ELB("Python") | |
with Cluster("Webserver Cluster"): | |
svc_group = [EC2("Spotify"),EC2("Shazam!"),EC2("YouTube"),EC2("REWIND!")] | |
API >> piton >> svc_group |
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 bs4 import BeautifulSoup | |
import spotipy, requests | |
from spotipy.oauth2 import SpotifyClientCredentials | |
def get_cuerda(artista, cancion): | |
martista = artista.lower().replace(' ','_') | |
mcancion = cancion.lower().replace(' ','_') | |
url = f'https://acordes.lacuerda.net/{martista}/{mcancion}' | |
bs = BeautifulSoup(requests.get(url).text, 'lxml') |
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 datetime, requests | |
import io, glob, os | |
import PyPDF2 | |
from bs4 import BeautifulSoup | |
fecha = datetime.datetime.now().strftime('%Y%m%d') | |
print('FECHA:', fecha) | |
root='https://www.mercuriovalpo.cl/impresa/%s/%s/%s/' %(fecha[:4], fecha[4:6], fecha[6:]) | |
base = root + 'papel' |
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 goblet import Goblet, goblet_entrypoint | |
app = Goblet(function_name="goblet_example") | |
goblet_entrypoint(app) | |
@app.route('/home') | |
def home(): | |
return {"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
from numba import jit | |
@jit(nopython=True) | |
def psum(p): | |
acc = 0 | |
for i in range(1,1000000): | |
acc += pow(i, -p) | |
return acc | |
import time |