This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# License: MIT; https://opensource.org/licenses/MIT | |
# Version: 0.0.1 | |
# Maintainer: https://gist.github.com/liquidgenius | |
#******************************************************************************* | |
# Pycharmer; A Pycharm Python project creator | |
#******************************************************************************* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# License: MIT; https://opensource.org/licenses/MIT | |
# Version: 0.0.1 | |
# Maintainer: https://gist.github.com/liquidgenius | |
# Gist: https://gist.github.com/liquidgenius/56167cfedc7270752d207377cf618fcf | |
#******************************************************************************* | |
# Masonite 3 Project Scaffolding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# https://orm.masoniteproject.com/ | |
# app.helpers.columns.py | |
from config.database import DB | |
from masoniteorm.collection import Collection | |
def columns(model): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ensure we have the latest pip and pipenv | |
pip3 install --upgrade pip pipenv | |
# Setup new Python 3.8 project | |
pipenv --python 3.8 | |
# Install aws-lambda-powertools | |
pipenv install boto3 aws-lambda-powertools | |
# Install dev dependencies | |
pipenv install black pytest isort mypy --dev --pre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from random import choice | |
import httpx | |
import fake_useragent | |
def Proxymesh(url, proxy_choices=None, headers=None, country='US'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass, fields as datafields | |
from ujson import dumps, loads | |
# Note: ujson seamlessly serializes dataclasses, unlike stdlib's json | |
@dataclass | |
class Point: | |
x: float | |
y: float | |
# Shallow dataclass can be rebuilt from dict/json: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
__license__ = "MIT" | |
__version__ = "0.0.1" | |
__maintainer__ = "https://github.com/liquidgenius" | |
__status__ = "Development" | |
from pathlib import Path | |
from pyngrok import ngrok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/tiangolo/fastapi/issues/883#issuecomment-575913215 | |
# You can probably use an async queue so your MQTT client will push messages to the queue and the WS server will get from the queue and send them to the WS client. | |
from asyncio import Queue | |
queue: Queue = None | |
@app.websocket("/ws") | |
async def websocket_endpoint(websocket: WebSocket): | |
await websocket.accept() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/13530258/886938 | |
import multiprocessing as mp | |
import time | |
fn = 'c:/temp/temp.txt' | |
def worker(arg, q): | |
'''stupidly simulates long running process''' | |
start = time.clock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymysql | |
import pandas as pd | |
from snowflake.sqlalchemy import URL as SFURL | |
from sqlalchemy import create_engine | |
from sqlalchemy.engine.url import URL | |
class OmniDB: | |
""" A minimal Python class for uniform API to both Snowflake and MySQL databases. | |
TODO: Error handling |
NewerOlder