Skip to content

Instantly share code, notes, and snippets.

View avcaliani's full-sized avatar
🎱
Learning, sharing, repeating...

Anthony Caliani avcaliani

🎱
Learning, sharing, repeating...
View GitHub Profile
@avcaliani
avcaliani / .md
Last active January 31, 2023 23:30
🌳 Terraform 4 Noobs

Terraform

This is a "quick and simple guide" about how to use Terraform in your projects 🤓

First Steps

First, install Terraform following their [installation guide].
Then check your installation...

💸 Credit Card - Fraud Investigation

By Anthony Vilarim Caliani

# #

This is an experiment using Spark array functions.
In this example I'm using a Fraudulent Transactions Data dataset, so thanks to Chitwan Manchanda for sharing his dataset.

@avcaliani
avcaliani / info.py
Last active March 22, 2022 00:56
#apache-spark #pyspark #info
"""Information Script for Apache Spark.
How to use?
> spark-submit info.py
"""
import os
import platform
import sys
from contextlib import contextmanager
@avcaliani
avcaliani / decorator.py
Created December 8, 2021 02:11
#python #decorator
import logging as log
import sys
from functools import wraps
from random import choice
from typing import Any, List
FRUITS = ['🍏', '🍎', '🍐', '🍊', '🍋', '🍌', '🍉', '🍇', '🍓', '🍈', '🍒', '🍑', '🥭', '🍍', '🥥', '🥝', '🍅']
SPORTS = ['⚽️', '🏀', '🏈', '⚾️', '🎾', '🏐', '🎱']
@avcaliani
avcaliani / Dockerfile
Last active October 16, 2021 22:19
🐳 Spark - Mini Cluster
FROM python:3.9
ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
ENV SPARK_HOME="/opt/spark"
ENV SPARK_VERSION="3.1.2"
ENV HADOOP_VERSION="3.2"
ENV PATH="$SPARK_HOME/bin:$PATH"
ENV PYSPARK_PYTHON=python
@avcaliani
avcaliani / check-venv.py
Last active March 22, 2022 00:57
#python #check-if-in-venv
import platform
import sys
if __name__ == '__main__':
py_version = platform.python_version()
prefix = sys.prefix
base_prefix = sys.base_prefix if py_version.startswith('3') else sys.exec_prefix
print('------------< venv checker >------------')
print('Python Version.: {}'.format(py_version))
print('Prefix.........: {}'.format(prefix))
@avcaliani
avcaliani / .md
Last active October 26, 2020 19:39
#code #apache-spark #positional-txt

🥑 Positional File

By Anthony Vilarim Caliani

# # # #

This is an example of writing a single positinal file.
In this example I'm using a Avocado Prices dataset, so thanks to Justin Kiggins for sharing his dataset.

The important thing here is the code, but if you want to execute it there is a run.sh to help you out.

@avcaliani
avcaliani / hwinfo-monitor.ipynb
Created August 13, 2020 22:37
hwinfo-monitor.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@avcaliani
avcaliani / wwii-weather.ipynb
Last active July 24, 2020 18:51
wwii-weather.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@avcaliani
avcaliani / .md
Last active September 21, 2020 11:39
#code #apache-spark #partitioned-parquet

🧩 Partitioned Parquet

By Anthony Vilarim Caliani

# # # #

This is an example of working with Partitioned Parquet, here you will find how to read and write partitioned parquet files.
In this example I'm using a Netflix Shows dataset, so thanks to Shivam Bansal for sharing his dataset.

The important thing here is the code, but if you want to execute it there is a run.sh to help you out.