Skip to content

Instantly share code, notes, and snippets.

View RHDZMOTA's full-sized avatar
🚀
Reminder to self: "fast & simple" is often better.

Rodrigo H. Mota RHDZMOTA

🚀
Reminder to self: "fast & simple" is often better.
View GitHub Profile
@RHDZMOTA
RHDZMOTA / alcohol_data_download.R
Last active October 28, 2024 07:09
Download and clean data from the World Health Organization - Global Health Observatory: Consumption of pure alcohol by type of beverage. The database contains data from 2010 of nearly 50 different countries.
# Radar Plots
# Example: consumption of pure alcohol by type of beverage
library(tibble)
# Download data -----------------------------------------------------------
# Data by country and type of beverage
url <- "http://apps.who.int/gho/athena/data/data-text.csv?target=GHO/SA_0000001398&profile=text&filter=COUNTRY:*;REGION:EUR;ALCOHOLTYPE:*"
# Download and read files
@RHDZMOTA
RHDZMOTA / dataviz_radarplot.R
Last active April 7, 2021 04:02
Create radar plot of the data: Consumption of pure alcohol by type of beverage. The following files are needed in the working directory: alcohol_data_download.R and data_cleaning.R
# Code to generate radar plot.
# Load required data and variables
source("alcohol_data_download.R")
source("data_cleaning.R")
# functions ---------------------------------------------------------------
library(ggplot2)
@RHDZMOTA
RHDZMOTA / dataviz_whatsapp.R
Last active April 1, 2016 04:29
This code generates visualizations of whatsapp's logs analysis. Two things are needed in the working directory: whatsapp's log file (.txt without media) and whatsapp_functions.R
# Whatsapp's data visualization
# by: Rodrigo Hernández Mota
# file name: dataviz_whatsapp.R
# V.1.0.0
# General structure
# This file was structured as data exploration process
# was developing. For such reason, the main sections
# contained and the visualizations are divided in:
# - word frequency
@RHDZMOTA
RHDZMOTA / functions_whatsapp.R
Last active February 13, 2023 10:12
Functions used in file: whatsapp_dataviz.R. Mainly data cleaning.
# Whatsapp's data visualization functions and data cleaning
# by: Rodrigo Hernández Mota
# file name: functions_whatsapp.R
# V.1.0.0
library(tibble)
library(tidyr)
# palette_colors ----------------------------------------------------------
# This function returns a vector of colours (character- HEX number)
@RHDZMOTA
RHDZMOTA / inverse_function.R
Last active May 2, 2016 02:01
General methodology to calculate the inverse function via a numeric approach.
# INVERSE FUNCTION
# by: Rodrigo Hernández Mota
# created in: 29/04/2016
# last modify: 02/05/2016
source("generate_dataset.R")
library(ggplot2)
library(tibble)
library(tidyr)
@RHDZMOTA
RHDZMOTA / inverse_example_dataset.R
Created April 29, 2016 19:08
Save file as "generate_dataset.R" to use with "inverse_function.R". This specific script was used in wordpress post in [add link]
# Example of inverse function
# Generating x-axis, pdf and cdf numeric values.
# last modifyed: 29/04/2016
library(ggplot2)
library(tibble)
library(tidyr)
@RHDZMOTA
RHDZMOTA / auxiliar_functions.py
Last active September 18, 2017 19:24
Use each file as a jupyter notebook cell. First copy and run the contents of auxiliar_functions.py.
%matplotlib inline
from scipy.integrate import odeint
import matplotlib.pyplot as plt
import numpy as np
# Print function
def print_results(soln, time):
show = 5
def get_head_and_tail(vector):
@RHDZMOTA
RHDZMOTA / README.md
Created February 5, 2018 00:39
Brilliant Basic Level: problem of the week of feb 5

1 X 2 X 3 X ... X 2018

My computer solves for the above product and finds its digit sum (sum of all its digits). It then repeats this process of calculating the digit sum until only one digit remains.

What digit is that?

@RHDZMOTA
RHDZMOTA / WSL_SSH.md
Last active April 14, 2024 19:58
SSH into the Windows Subsystem for Linux (ubuntu)

SSH Into the Windows Subsystem for Linux (UBUNTU)

Instructions to create an ssh connection into the windows subsystem for linux.

Context

Instructions

@RHDZMOTA
RHDZMOTA / docker-compose.yml
Created April 22, 2019 23:37
Docker compose file for kafka + redis
version: "3"
services:
# KAFKA RELATED SERVICES
zookeeper:
image: confluentinc/cp-zookeeper:5.2.1
hostname: zookeeper
container_name: zookeeper
ports: