Skip to content

Instantly share code, notes, and snippets.

View devsetgo's full-sized avatar

Mike devsetgo

View GitHub Profile
@devsetgo
devsetgo / docker-compose.yml
Created June 8, 2019 15:54 — forked from pantsel/docker-compose.yml
example docker-compose.yml for kong, postgres and konga
version: "3"
networks:
kong-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
@devsetgo
devsetgo / Unicode table
Created December 19, 2019 16:09 — forked from ivandrofly/Unicode table
Unicode table - List of most common Unicode characters *
Unicode table - List of most common Unicode characters *
* This summary list contains about 2000 characters for most common ocidental/latin languages and most printable symbols but not chinese, japanese, arab, archaic and some unprintable.
Contains character codes in HEX (hexadecimal), decimal number, name/description and corresponding printable symbol.
What is Unicode?
Unicode is a standard created to define letters of all languages ​​and characters such as punctuation and technical symbols. Today, UNICODE (UTF-8) is the most used character set encoding (used by almost 70% of websites, in 2013). The second most used character set is ISO-8859-1 (about 20% of websites), but this old encoding format is being replaced by Unicode.
How to identify the Unicode number for a character?
Type or paste a character:
@devsetgo
devsetgo / docker-compose.yml
Created December 22, 2019 05:32 — forked from Mau5Machine/docker-compose.yml
Traefik Configuration and Setup
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.0
restart: always
@devsetgo
devsetgo / app.py
Last active November 8, 2021 05:31
Loguru configuration with Starlette and Uvicorn.
import logging
from pathlib import Path
from loguru import logger
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route
# set log level [DEBUG, INFO, WARNING, ERROR, CRITICAL]
LOGURU_LOGGING_LEVEL = "WARNING"
@devsetgo
devsetgo / default.j2
Created June 30, 2020 23:51 — forked from perfecto25/default.j2
Python function to send email using a Jinja HTML template
<style type="text/css">
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 300;
src: local('Open Sans Light'), local('OpenSans-Light'), url(http://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTa-j2U0lmluP9RWlSytm3ho.woff2) format('woff2');
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
}
.body {
width: 90%;
@devsetgo
devsetgo / remove_empty_elements.py
Created September 30, 2020 15:41 — forked from nlohmann/remove_empty_elements.py
Remove empty arrays, objects or null elements from a JSON value
def remove_empty_elements(d):
"""recursively remove empty lists, empty dicts, or None elements from a dictionary"""
def empty(x):
return x is None or x == {} or x == []
if not isinstance(d, (dict, list)):
return d
elif isinstance(d, list):
return [v for v in (remove_empty_elements(v) for v in d) if not empty(v)]
@devsetgo
devsetgo / tqdm_unsync.py
Created October 16, 2020 22:55
Using TQDM and Unsync together.
# -*- coding: utf-8 -*-
"""
This is how to use TQDM and Unsync together. This is for multiple threads.
TQDM will keep the main visable after it completes.
TQDM will remove the sub thread progress bars as they complete.
"""
import random
import time
@devsetgo
devsetgo / pdf_margin.py
Last active June 13, 2024 13:05
Get margin from PDF files
import fitz # PyMuPDF
def get_margins(pdf_path):
try:
# Open the PDF file
document = fitz.open(pdf_path)
page = document[0] # Get the first page
# Get page dimensions
page_rect = page.rect