Skip to content

Instantly share code, notes, and snippets.

View brenouchoa's full-sized avatar

Breno Rocha Uchôa brenouchoa

View GitHub Profile
@h3
h3 / color.py
Last active June 27, 2019 19:38
Simple shell color outpout function
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import sys
def c(i):
"""
@karanlyons
karanlyons / method_missing.py
Last active August 7, 2017 17:47
method_missing for Python: All the headaches of Ruby, now with added whitespace!
import dis
import inspect
class MethodMissingMixin:
def __getattr__(self, attr):
if hasattr(getattr(self, '__methodmissing__', None), '__call__'):
parent_frame = inspect.currentframe().f_back
instructions = dis.get_instructions(parent_frame.f_code)