This file contains hidden or 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 http.server import HTTPServer, BaseHTTPRequestHandler | |
import argparse | |
import logging | |
import sys | |
import os | |
logging.basicConfig(format="%(asctime)s %(levelname)s %(message)s", level=logging.INFO) | |
log = logging.getLogger() | |
def mkhandler(imagep): |
This file contains hidden or 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 sys | |
import itertools | |
import json | |
import argparse | |
from PIL import Image, ImageDraw | |
def parse_args(): | |
parser = argparse.ArgumentParser(usage="python3 drawpoly.py -p p1.json ... <input_image >out.jpg") | |
parser.add_argument("-p", "--poly-jsons", type=str, required=True, nargs="+", help=""" | |
JSON file(s) path containing polygon to draw. |
This file contains hidden or 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 | |
# Get the latest version of a library installed in a linux system. | |
# Usage: ./libver.sh lib | |
# Example: ./libver.sh cuda | |
# Explain: search for lib$lib.so in the system, then extract version from name. | |
# This assumes that the library "lib" can be found under /usr as: /path/to/liblib.so.x.y.z | |
if [ -z "$1" ]; then | |
>&2 echo "Usage: $0 lib" |
This file contains hidden or 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
# Example usage: | |
# $ ACR=someregistry bash acrlookup.sh | |
# repo1:latest | |
# repo1:0.1.0 | |
# repo2:latest | |
# $ cat tags_someregistry.txt | |
# repo1:latest | |
# repo1:0.1.0 | |
# repo2:latest |
This file contains hidden or 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 | |
# Thanks goes to @pete-otaqui for the initial gist: | |
# https://gist.github.com/pete-otaqui/4188238 | |
# | |
# Original version modified by Marek Suscak | |
# | |
# works with a file called VERSION in the current directory, | |
# the contents of which should be a semantic version number | |
# such as "1.2.3" or even "1.2.3-beta+001.ab" |
This file contains hidden or 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 | |
""" | |
Convert Pipfile.lock into requirements.txt | |
It generates an output similar to `pipenv lock -r` | |
without the need to actually locking the file. | |
See https://github.com/pypa/pipenv/issues/3493 | |
This script was created to include the definition of sources |
This file contains hidden or 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
# call once per file then retrieve with logging.getLogger(__file__) | |
import logging | |
def setup_logger(level): | |
log = logging.getLogger(__file__) | |
handler = logging.StreamHandler() | |
formatter = logging.Formatter(f'%(asctime)-15s {__file__} %(message)s') | |
handler.setFormatter(formatter) | |
log.addHandler(handler) |
This file contains hidden or 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 threading import Timer | |
class Interval: | |
def __init__(self, func, secs): | |
# Fuction to be called back | |
self.func = func | |
# Interval | |
self.secs = secs | |
# Timer thread object |