Skip to content

Instantly share code, notes, and snippets.

View juancarlospaco's full-sized avatar
👑
https://t.me/NimArgentina

Juan Carlos juancarlospaco

👑
https://t.me/NimArgentina
View GitHub Profile
@juancarlospaco
juancarlospaco / static_typing_python3.py
Last active May 22, 2023 17:19
Python3 Annotations as Static Typing, checks code blocks inputs and outputs enforcing Types via Decorator (change "log.critical" to "log.exception" to Force Fail).
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import functools
import logging as log
def typecheck(f):
"""Decorator for Python3 annotations to type-check inputs and outputs."""
@juancarlospaco
juancarlospaco / encoding_debug_no_root.py
Last active April 6, 2018 19:32
Debug Encoding and Check for root.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os
import logging as log
from getpass import getuser
from platform import platform, python_version
@juancarlospaco
juancarlospaco / logging_logger.py
Last active April 6, 2018 19:26
Logging Logger for Logs, the best in the world!, Colored, SysLog, Log File, CrossPlatform, Optional Arguments, and more...
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os
import logging as log
from copy import copy
from tempfile import gettempdir
@juancarlospaco
juancarlospaco / post_exec_message.py
Last active April 6, 2018 19:37
Simple Post-Execution Message for Apps, print used Resources and Running Time (A.K.A. Uptime)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os
import logging as log
from datetime import datetime
try:
@juancarlospaco
juancarlospaco / check_working_folder.py
Last active January 10, 2022 01:07
Check working folder, for all possible things that can go wrong.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os
import logging as log
try:
from shutil import disk_usage
@juancarlospaco
juancarlospaco / setup.py
Last active June 5, 2024 22:21
setup.py Template, Generic but Complete, with instructions to Release to PyPI, DEB, RPM, PKGBUILD, EXE, EGG, ZIP, PYZ, and more.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# To generate DEB package from Python Package:
# sudo pip3 install stdeb
# python3 setup.py --verbose --command-packages=stdeb.command bdist_deb
#
#
# To generate RPM package from Python Package:
@juancarlospaco
juancarlospaco / qtabwidget_custom.py
Last active April 6, 2018 19:30
Tabs like ChromeOS for Python3 Qt5 with Extras like UnDock/ReDock Tabs, Pin/UnPin Tabs, On Mouse Hover Previews for all Tabs except current Tab, Colored Tabs, Change Position, Change Shape, Mouse Hover Tracking, Add Tab Plus Button, and more.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Custom TabBar and TabWidget.
Tabs like ChromeOS for Python3 Qt5 with Extras like UnDock / ReDock Tabs,
Pin / UnPin Tabs, On Mouse Hover Previews for all Tabs except current Tab,
Colored Tabs, Change Position, Change Shape, Fading Transition effect,
Close all Tabs to the Right, Close all Tabs to the Left, Close all other Tabs,
@juancarlospaco
juancarlospaco / qlcd_datetime_countdown.py
Last active April 6, 2018 19:29
Custom QLCDNumber that shows date and time, and a count down, simple but useful.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Custom QLCDNumber that shows date and time, optional background image."""
import os
from datetime import datetime
@juancarlospaco
juancarlospaco / qcolorbutton.py
Created June 23, 2015 21:38
qColorButton, use to configure colors, shows a color on itself, show HEX/RGBA Values on Tooltip, and opens QColorDialog when clicked.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""qColorButton, use to configure colors, opens QColorDialog when clicked."""
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtGui import QColor, QPixmap, QIcon
@juancarlospaco
juancarlospaco / qmainwindow.py
Last active March 1, 2022 02:38
Custom QMainWindow with cool features for Python3 Qt5.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Custom QMainWindow Widget."""
import os
import sys
from random import randint