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 / html2ebook.py
Last active May 10, 2018 19:18
HTML5 to eBook converter, with Table Of Contents, Compression, optional Metadata, optional output filename, Mobile Friendly, ePub v.3.0.1 compliant, runs as standalone, run as module, Python3, NO Dependencies just Python Standard Lib only.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""HTML2eBook a tiny function that converts HTML5 to eBook,Mobile Friendly."""
import os
import zipfile
from getpass import getuser
@juancarlospaco
juancarlospaco / stealth_string.py
Last active April 6, 2018 19:33
Stealth Strings, hidden and dangerous.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Stealth Strings, hidden and dangerous."""
import base64
import binascii
import codecs # importing codecs is optional, it will work ok if no codecs.
@juancarlospaco
juancarlospaco / http_serve_livereload.py
Created September 24, 2015 05:54
HTTP Server with LiveReload if any else builtin Simple HTTP Server, asks to install LiveReload if not installed but still works Ok, tested on Python 3.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""HTTP Serve with LiveReload."""
import os
from webbrowser import open_new_tab
@juancarlospaco
juancarlospaco / templar.py
Last active April 6, 2018 19:25
Templar is a tiny Template Engine that Render and Runs native Python 3. Optionally it can Minify the rendered output, or load from a file or file-like object.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Templar is a tiny Template Engine that Render and Runs native Python."""
import re
@juancarlospaco
juancarlospaco / pretty_json.py
Last active January 10, 2022 02:58
Pretty-Print JSON from dict to string, very Human-Friendly but still Valid JSON, Python3.
from json import dumps
def json_pretty(json_dict: dict) -> str:
"""Pretty-Printing JSON data from dictionary to string."""
_json = dumps(json_dict, sort_keys=1, indent=4, separators=(",\n", ": "))
posible_ends = tuple('true false , " ] 0 1 2 3 4 5 6 7 8 9 \n'.split(" "))
max_indent, justified_json = 1, ""
for json_line in _json.splitlines():
if len(json_line.split(":")) >= 2 and json_line.endswith(posible_ends):
@juancarlospaco
juancarlospaco / qpdf.py
Last active April 6, 2018 19:35
PDF Conversor powered by Qt5, does NOT show up any GUI, just needs an URL string, then it Prints PDF, and returns file path string, uses UUID if no output filename is passed, optional Landscape orientation if supported, CSS3 Just Works!.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""PDF Conversor powered by Qt5."""
from uuid import uuid4
from PyQt5.QtCore import QUrl
@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
@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 / 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 / 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,