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
cve_ent poblacion nombre 26-02-2020 27-02-2020 28-02-2020 29-02-2020 01-03-2020 02-03-2020 03-03-2020 04-03-2020 05-03-2020 06-03-2020 07-03-2020 08-03-2020 09-03-2020 10-03-2020 11-03-2020 12-03-2020 13-03-2020 14-03-2020 15-03-2020 16-03-2020 17-03-2020 18-03-2020 19-03-2020 20-03-2020 21-03-2020 22-03-2020 23-03-2020 24-03-2020 25-03-2020 26-03-2020 27-03-2020 28-03-2020 29-03-2020 30-03-2020 31-03-2020 01-04-2020 02-04-2020 03-04-2020 04-04-2020 05-04-2020 06-04-2020 07-04-2020 08-04-2020 09-04-2020 10-04-2020 11-04-2020 12-04-2020 13-04-2020 14-04-2020 15-04-2020 16-04-2020 17-04-2020 18-04-2020 19-04-2020 20-04-2020 21-04-2020 22-04-2020 23-04-2020 24-04-2020 25-04-2020 26-04-2020 27-04-2020 28-04-2020 29-04-2020 30-04-2020 01-05-2020 02-05-2020 03-05-2020 04-05-2020 05-05-2020 06-05-2020 07-05-2020 08-05-2020 09-05-2020 10-05-2020 11-05-2020 12-05-2020 13-05-2020 14-05-2020 15-05-2020 16-05-2020 17-05-2020 18-05-2020 19-05-2020 20-05-2020 21-05-2020 22-05-2020 23-05-2020 24-05-2020 25-05-2020 26-05-202
@RHDZMOTA
RHDZMOTA / complex-python-lambdas.py
Created December 14, 2021 05:07
An updated version of George Lydakis python script on lambda functions: http://ldkge.com/complex-python-lambdas.html
_ = (
lambda: [
_
# Imports
for sys in [__import__('sys')]
for math in [__import__('math')]
# Helper functions
for sub in [lambda *vals: None]
for fun in [lambda *vals: vals[-1]]
i, a, b = (0, 0, 1); s=(
'i, a, b = (i+1, b, a+b);'
'print(f"i, a, b = ({i}, {a}, {b}); s={repr(s)}; exec(s) # fib({i})={a} ")'
); exec(s) # fib(0)=0
import inspect
import json
from typing import Dict, TypeVar
SerializableDataType = TypeVar(
"SerializableDataType",
bound="Serializable"
)
from typing import List, Tuple, Optional
RETURN_TYPE = Optional[Tuple[List[int], List[int]]]
def bisect(my_list: List[int], max_val: int) -> RETURN_TYPE:
partial_sum = 0
for i, val in enumerate(my_list):
partial_sum += val
if partial_sum > max_val:
name: Check Python Style
on: [pull_request]
jobs:
build:
name: Style Check
runs-on: ubuntu-18.04
steps:
- name: clone-repo
@RHDZMOTA
RHDZMOTA / style-check.sh
Created November 12, 2021 23:32
Example: Pycodestyle command
pycodestyle . --max-line-length=120 --exclude venv
@RHDZMOTA
RHDZMOTA / scalene-profiler.sh
Created November 12, 2021 22:49
Example usage: Scalene python profiler
scalene \
--profile-all \
--reduced-profile \
--cpu-percent-threshold 1 \
my_script.py
@RHDZMOTA
RHDZMOTA / swapcase.py
Last active November 10, 2021 19:13
Swap-case in Python without using the swapcase built-in method.
# Challenge: implement swapcase without using the built-in method
def swapcase(string: str) -> str:
return "".join(
char.lower() if char.isupper() else char.upper()
for char in string
)
assert swapcase("AbCd") == "aBcD"
@RHDZMOTA
RHDZMOTA / pycosnippets-command.sh
Created November 8, 2021 06:06
PyCo Snippets: Commandline Usage Example
pycosnippets run-gist \
--user rhdzmota \
--file hello-world.py \
--gist-id 42bcb9e078cae8694f1240808232a2ac