Skip to content

Instantly share code, notes, and snippets.

View marcosdly's full-sized avatar

Marcos Bião marcosdly

View GitHub Profile
@marcosdly
marcosdly / is_builtin.py
Created October 30, 2024 14:12
Check if object is a Python built-in, a.k.a. comes from standard "builtins" module
"""
Turns out the term "built-in" is it's own topic of discussion around those studying
Python's inner workings.
SEE https://stackoverflow.com/questions/49756646/when-is-a-function-in-a-standard-library-module-called-a-built-in-function
Here, my definition of "built-in" is that it comes from the standard module called
"builtins". Well, it turns out that, even then, there's some discussion to be had
about it.
SEE https://stackoverflow.com/questions/40052224/check-if-variable-is-a-standard-type-function-in-python
SEE https://stackoverflow.com/questions/1322068/determine-if-python-variable-is-an-instance-of-a-built-in-type
@marcosdly
marcosdly / sources.list
Created December 19, 2023 13:12 — forked from justbuchanan/sources.list
/etc/apt/sources.list from an Ubuntu 14.04 installation
#deb cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
@marcosdly
marcosdly / asyncio_loop_in_thread.py
Created August 18, 2023 03:57 — forked from dmfigol/asyncio_loop_in_thread.py
Python asyncio event loop in a separate thread
"""
This gist shows how to run asyncio loop in a separate thread.
It could be useful if you want to mix sync and async code together.
Python 3.7+
"""
import asyncio
from datetime import datetime
from threading import Thread
from typing import Tuple, List, Iterable