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
from serializer import SimpleSerializer
from dataclasses import dataclass
@dataclass
class Something(SimpleSerializer['Something']):
name: str
value: int
@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:
@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 / banxico-timeseries.py
Last active January 28, 2021 07:08
Less than 50 lines of code to plot an interactive time series chart with query parameters.
import datetime
import altair as alt
import streamlit as st
import pandas as pd
import requests
app_state = st.experimental_get_query_params()
@st.cache
import datetime
import re
import streamlit as st
import pandas as pd
import requests
# Get application state
app_state = st.experimental_get_query_params()

Python Test

Please solve the following problems in order:

  • fibonacci
  • tree-traversal

Be sure to ask questions, explain your reasoning and talk through your solution!

Fibonacci

@RHDZMOTA
RHDZMOTA / scorecard.py
Created December 3, 2020 15:45
Simple Python Scorecard - Example
from dataclasses import dataclass
from typing import Callable, Dict, Optional
import pandas as pd
@dataclass
class CardConfig:
target_score: int
target_odds: int
@RHDZMOTA
RHDZMOTA / repository-setup.md
Last active September 28, 2020 08:52
CREDIT RISK: Repository Setup

Repo Setup

Use this guide to setup your class repository.

Step 1: Create a private repo

Create a new repository on your personal github account: https://github.com/new

  • Repository Name: CREDIT-RISK-2020B
  • Select the Private option.
@RHDZMOTA
RHDZMOTA / python-decorators.md
Created September 18, 2020 00:22
Python Decorators Homework

Homework: Python Decorators

Submit your answer with ONLY the definition of the decorator that solves each problem.

Common imports:

import functools
import random
@RHDZMOTA
RHDZMOTA / essay-grading.md
Last active May 26, 2024 10:20
Simple essay grading system.

The number of words in the essay should be between 700 and 1000 words. Students should follow the “five-paragraph essay” format, which consists of three principal components:

  • Introduction - The principal purpose of the introduction is to expose the thesis statement explicitly. An effective introductory paragraph usually begins with a hook to grab the reader’s attention. This might be a personal anecdote, relevant statistics, or a quote. After that, the writer should move on to a clear, one-sentence thesis statement.
  • Body - A good essay usually contains roughly three body paragraphs. The first sentence of these paragraphs is known as the topic sentence and should provide an argument in favor of the thesis. Body paragraphs make use of examples, supporting evidence, statistics, and citations. To ensure continuity, you might want to use a “transition phrase” to connect different paragraphs (e.g., “moreover”, “on the other hand”, “by contrast”, “furthermore”).
  • Conclusion - This paragraph should