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
Fetching certificate chain for: untrusted-root.badssl.com | |
0: Subject: <Name(C=US,ST=California,L=San Francisco,O=BadSSL,CN=*.badssl.com)> | |
0: Issuer: <Name(C=US,ST=California,L=San Francisco,O=BadSSL,CN=BadSSL Untrusted Root Certificate Authority)> | |
0: Serial Number: 16983658469221716870 | |
0: Validity: From 2024-02-21 21:28:32+00:00 to 2026-02-20 21:28:32+00:00 | |
{idx}: Extensions: | |
0.0: basicConstraints: <BasicConstraints(ca=False, path_length=None)> | |
0.1: subjectAltName: <SubjectAlternativeName(<GeneralNames([<DNSName(value='*.badssl.com')>, <DNSName(value='badssl.com')>])>)> | |
1: Subject: <Name(C=US,ST=California,L=San Francisco,O=BadSSL,CN=BadSSL Untrusted Root Certificate Authority)> |
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 socket | |
import sys | |
""" | |
Usage: python3 test_tcp_socket.py [host [port]] | |
Where host can be a string or IPv4 address. Port defaults to 80. | |
""" | |
host = sys.argv[1] if len(sys.argv)>1 and sys.argv[1] \ | |
else "example.com" | |
port = int(sys.argv[2]) if len(sys.argv)>2 and sys.argv[2] else 80 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
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 | |
# Usage: | |
# 0 * * * * /home/zerolagtime/bin/do_backup.sh -t hourly -s /home/zerolagtime/Documents -d /data/backups/zerolagtime/Documents/ -l /home/zerolagtime/backups-documents.log -k Documents # JOB_ID_1 | |
# 0 0 * * * /home/zerolagtime/bin/do_backup.sh -t daily -s /home/zerolagtime/Documents -d /data/backups/zerolagtime/Documents/ -l /home/zerolagtime/backups-documents.log -k Documents # JOB_ID_2 | |
# 0 0 * * 1 /home/zerolagtime/bin/do_backup.sh -t monthly -s /home/zerolagtime/Documents -d /data/backups/zerolagtime/Documents/ -l /home/zerolagtime/backups-documents.log -K Documents # JOB_ID_3 | |
VERSION="2.2" | |
DEBUG=0 | |
LOGFILE="" | |
KEYWORD="" |
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
$ ./script-template.sh --noisy | |
[[[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:200] command -v /tmp/script-template.sh | |
[[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:200] dirname /tmp/script-template.sh | |
[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:200] cd /tmp | |
[[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:201] pwd | |
[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:201] here=/tmp | |
[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:202] log_debug 'Starting main function of /tmp/script-template.sh' | |
[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:159] main(): : | |
[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:203] main | |
[Wed 22 Sep 2021 09:32:21 PM EDT][/tmp/script-template.sh:24] main(): log_info 'our informational message' |
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 | |
# This is a template script that has built-in logging | |
# with colored messages. It also supports command line parsing. | |
usage() { | |
echo "$0 [-h | --help] [-v | --verbose]" | |
echo " [-q | --quiet] [-w str | --with-parameter=str]" | |
echo " [--noisy]" | |
echo "Here is the reason this script exists." | |
echo "Where:" |
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 | |
# this is a poor man's substitute for the envsubst command | |
function internal_envsubst() { | |
tfile=$(mktemp) | |
# use sed to build a sed input file specific to the current environment variables | |
env | sed -E -e ' | |
# delete any special cases that make a mess of things | |
/^_=/d; | |
# deal with variables that have backslashes in them: \\tsclient\home |
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 python3 | |
# Copyright 2015 by Charlie Todd except where noted below. | |
# You are granted permission to adapt this gist for your own project, | |
# but not to claim the work as entirely your own. Attribution must | |
# be provided in any derivative works in such a fashion that the | |
# final user of the software can see and understand the attribution. | |
import sys | |
import zipfile | |
import xml | |
import xml.dom.minidom |