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
# usage: source colored_text.sh | |
# c_red("hello") | |
export C_BLACK="\\033[0;30m" | |
export C_DK_GRAY="\\033[1;30m" | |
export C_RED="\\033[0;31m" | |
export C_LT_RED="\\033[1;31m" | |
export C_GREEN="\\033[0;32m" |
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 | |
# show prompt without a newline | |
echo -n "Password:" | |
# Turn off echo | |
stty -echo | |
# Read what the user typed | |
read passwd |
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
# GNU sed | |
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | |
# Mac sed | |
sed -E "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" |
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 | |
# | |
# This file echoes a bunch of color codes to the | |
# terminal to demonstrate what's available. Each | |
# line is the color code of one forground color, | |
# out of 17 (default + 16 escapes), followed by a | |
# test use of that color on all nine background | |
# colors (default + 8 escapes). | |
# |
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 | |
# see also | |
# - Google's Shell Style Guide: https://google.github.io/styleguide/shell.xml | |
# - ShellCheck: https://github.com/koalaman/shellcheck | |
# src: | |
# - http://hackaday.com/2017/07/21/linux-fu-better-bash-scripting | |
# - https://dev.to/thiht/shell-scripts-matter |
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 python3 | |
""" | |
Documentation about this script or module | |
""" | |
import os | |
import sys | |
from datetime import datetime | |
import argparse |
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 python3 | |
""" | |
Documentation | |
See also https://www.python-boilerplate.com/flask | |
""" | |
import os | |
import argparse | |
from flask import Flask, jsonify, send_file | |
from flask_cors import CORS |
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 | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import dns.resolver | |
res = dns.resolver.Resolver() | |
ans = res.query("www.google.com", "A") | |
print("ans={}".format(ans)) |
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/python3 | |
import uuid | |
def guid_to_string(binary_guid: bytes) -> str: | |
return str(uuid.UUID(bytes_le=binary_guid)).lower() |
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 | |
# -*- coding: utf-8 -*- | |
# src: https://powerfulpython.com/blog/making-unreliable-apis-reliable-with-python/ | |
# | |
# example usage: | |
# retry_on_auth_failure = RetryOnAuthFailure() | |
# retry_on_server_failure = RetryOnServerFailure(retries=5) | |
# | |
# @retry_on_server_failure |