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
#!/bin/bash | |
# clone all gists of the accou | |
# with url id | |
#for name in $( gh gist list | awk '{print $2}'); do gh gist clone $name; done; | |
# with description folder | |
#gh api \ |
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
# Variables | |
variable "region"{ | |
type = string | |
} | |
variable "email_list"{ | |
type = list(string) | |
} |
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
println(1.getClass) | |
println("Hello").getClass | |
println(println("Hello").getClass) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
ALTER TABLE `dataset.table` | |
SET OPTIONS ( | |
partition_expiration_days=30 | |
); |
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 pandas as pd | |
from google.cloud import firestore | |
db = firestore.Client() | |
users = list(db.collection(u'users').stream()) | |
users_dict = list(map(lambda x: x.to_dict(), users)) | |
df = pd.DataFrame(users_dict) |
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
def memory_usage(): | |
""" | |
:return: memory usage in MB | |
""" | |
mem = psutil.Process(os.getpid()).memory_info().rss | |
return mem / 1024 ** 2 |
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
# Function to apply a function over multiple cores | |
@print_timing | |
def parallel_apply(apply_func, groups, nb_cores): | |
with Pool(nb_cores) as p: | |
results = p.map(apply_func, groups) | |
return pd.concat(results) | |
# Parallel apply using 1 core | |
parallel_apply(take_mean_age, athlete_events.groupby('Year'), 1) |
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
fecha = "20200413191418" | |
objeto_fecha = datetime.strptime(fecha, '%Y%m%d%H%M%S').strftime('%Y-%m-%dT%H:%M:%S') | |
print(objeto_fecha) | |
print(type(objeto_fecha)) | |
#result: | |
# 2020-04-13T19:14:18 | |
# <class 'str'> |
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
os.environ.setdefault("DEPLOY", "DEV") |
NewerOlder