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 / environment-variable-check.sh
Created May 8, 2020 20:22
You can use the following function to check if an environment variable is set via parameter expansion. Early exit if it's not.
#!/usr/bin/env bash
function environ-check() {
local environ_tag="${1}"
local environ_val="${!1}"
if [[ -z "${environ_val}" ]]
then echo "Environ variable is not set ${environ_tag}"; exit 1
fi
}
import inspect
import json
from typing import Dict, TypeVar
SerializableADT = TypeVar("SerializableADT", bound="Serializable")
class Serializable:

Keybase proof

I hereby claim:

  • I am rhdzmota on github.
  • I am rhdzmota (https://keybase.io/rhdzmota) on keybase.
  • I have a public key ASCLjW-y4L43TZVJ76_0iElh_vZInP3rtww0Oud7lAUvdgo

To claim this, I am signing this object:

@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
@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 / 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 / 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

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

import datetime
import re
import streamlit as st
import pandas as pd
import requests
# Get application state
app_state = st.experimental_get_query_params()
@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