Skip to content

Instantly share code, notes, and snippets.

@romicofre
romicofre / memory_usage.py
Created June 28, 2020 00:56
Memory usage in MB
def memory_usage():
"""
:return: memory usage in MB
"""
mem = psutil.Process(os.getpid()).memory_info().rss
return mem / 1024 ** 2
@romicofre
romicofre / firestore_to_pandas_dataframe.py
Created June 28, 2020 01:03
Load firestore table to pandas dataframe
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)
@romicofre
romicofre / add_partition_expiration.sql
Created June 30, 2020 13:56
Add expiration to partition BigQuery
ALTER TABLE `dataset.table`
SET OPTIONS (
partition_expiration_days=30
);
@romicofre
romicofre / Carga_datos_bigquery_Colab.ipynb
Last active February 1, 2021 01:24
Cargar datos desde Google Colab a Bigquery
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@romicofre
romicofre / var_class.scala
Created February 22, 2021 15:03
Get variable class (get type scala)
println(1.getClass)
println("Hello").getClass
println(println("Hello").getClass)
@romicofre
romicofre / aws_create_user_by_list_terraform.tf
Last active July 2, 2023 21:10
AWS - Create a list users with Terraform resource
# Variables
variable "region"{
type = string
}
variable "email_list"{
type = list(string)
}
@romicofre
romicofre / init_gists.sh
Created April 28, 2024 02:48
Admin Gists
#!/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 \