Skip to content

Instantly share code, notes, and snippets.

View RHDZMOTA's full-sized avatar
👨‍💻
More info at: rhdzmota.com

Rodrigo H. Mota RHDZMOTA

👨‍💻
More info at: rhdzmota.com
View GitHub Profile
@RHDZMOTA
RHDZMOTA / code.py
Last active February 6, 2021 21:17
GameStop - Time Series Animation (python)
import json
import datetime as dt
import requests
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import pandas as pd
GIST_URL = "https://gist.githubusercontent.com/RHDZMOTA/db699a97eef5e77ca4d072a8ba1a7f48/raw/6d45c74d93a72a4e38fb8ad17dd8983e76e76109/gamestop-jan2021.json"
@RHDZMOTA
RHDZMOTA / random_string.py
Last active June 22, 2021 05:44
Python: Random String
import secrets
import string
def get_random_string(
length: int,
case_sensitive: bool = False,
include_digits: bool = False,
include_special_characters: bool = False
) -> str:
from serializer import SimpleSerializer
from dataclasses import dataclass
@dataclass
class Something(SimpleSerializer['Something']):
name: str
value: int
@RHDZMOTA
RHDZMOTA / databricks-job.json
Created July 15, 2021 21:47
Databricks JSON JOB (Layout)
{
"name": "My Job Name",
"new_cluster": {
"spark_version": "7.5.x-scala2.12",
"node_type_id": "m4.xlarge",
"aws_attributes": {
"zone_id": "us-west-2a",
"instance_profile_arn": <AWS-PROFILE-ARN>,
"availability": "SPOT_WITH_FALLBACK",
"ebs_volume_type": "GENERAL_PURPOSE_SSD",
@RHDZMOTA
RHDZMOTA / last.py
Last active August 21, 2021 18:09
Get the last element of any python iterator.
from typing import Any, Iterator, Optional
def last(iterator: Iterator[Any]) -> Optional[Any]:
last = None
for last in iterator:
continue
return last

Shareable Code Sippets

Share beautiful code snippets by using the Github Gists <> Carbon App integration!

The idea is simple:

  1. Identify your github gist's ID

    • https://gist.github.com/<user>/<gist-id>
  2. Append it into the carbo-app URL

@RHDZMOTA
RHDZMOTA / hello.py
Created August 22, 2021 05:36
Python script: hello
import os
import argparse
from typing import Optional
DEFAULT = os.environ.get("DEFAULT", "world")
def hello(name: Optional[str] = None):
print(f"Hello, {name or DEFAULT}.")
@RHDZMOTA
RHDZMOTA / pyenv-manage.sh
Last active September 10, 2021 19:17
Cross operative system pyenv installer.
manage() {
local command="${1}"
case "${command}" in
install)
case "${OSTYPE}" in
msys)
echo "Installing pyenv-win"
git clone https://github.com/pyenv-win/pyenv-win.git "${HOME}/.pyenv-github"
ln -s "${HOME}/.pyenv-github/pyenv-win" "${HOME}/.pyenv"
@RHDZMOTA
RHDZMOTA / hello.py
Last active September 19, 2021 06:00
import os
HELLO_WORLD_DEFAULT = os.environ.get(
"HELLO_WORLD_DEFAULT",
default="World"
)
def hello(world: str = HELLO_WORLD_DEFAULT) -> str:
return f"Hello, {world}!"
32.502345269453031 31.70700584656992
53.426804033275019 68.77759598163891
61.530358025636438 62.562382297945803
47.475639634786098 71.546632233567777
59.813207869512318 87.230925133687393
55.142188413943821 78.211518270799232
52.211796692214001 79.64197304980874
39.299566694317065 59.171489321869508
48.10504169176825 75.331242297063056
52.550014442733818 71.300879886850353