Skip to content

Instantly share code, notes, and snippets.

View lucid281's full-sized avatar

Josh Francisco lucid281

View GitHub Profile
@lucid281
lucid281 / main.py
Last active April 22, 2020 17:32
gcloud functions - auth, cluster discovery and connect to kubernetes api with python
import googleapiclient.discovery
from tempfile import NamedTemporaryFile
import kubernetes
import base64
projectId = 'PROJECTID'
def token(*scopes):
@lucid281
lucid281 / lucid_python_logging.md
Last active June 13, 2018 12:28
Add simple, useful, logging functions to your Python3 code!

Lucid Logging v1

Programatically create a reasonably intelligent logger.

  • Generates functions for log levels
  • Logs user, calling filename, co_name's caller, and co_name of the code calling the debug message.
import os
import sys
import logging
from pathlib import Path
@lucid281
lucid281 / sanitize.py
Created March 20, 2018 16:52
Python function for sanitizing user supplied input
def sanitize(inputstr):
sanitized = inputstr
badstrings = [
';',
'$',
'&&',
'../',
'<',
'>',
'%3C',