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 | |
# | |
# Run a simple command every 15 seconds and report whether it passes | |
# or fails. It can be used to check for disconnected hosts (a | |
# heartbeat test). | |
# | |
# The minimum valid interval depends on the time it takes to execute | |
# the command. | |
# | |
# Usage: |
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.7 | |
''' | |
Demonstrate the RSA algorithm key generation, encryption and | |
decryption with a simple padding scheme. | |
It is useful for understanding how RSA works in an ecosystem of | |
padding and translation to encrypt and decrypt text information. | |
It was written because many of examples of RSA do a great job | |
of describing the algorithm but they do not show an end to end |
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 | |
# | |
# Function that parses semantic versioning striings of | |
# the form: | |
# MAJOR.MINOR.PATCH([+-].*)? | |
# | |
# Parse the major, minor and patch versions | |
# out. | |
# You use it like this: |
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 how to make statements verbose with custom information. | |
# | |
function fct() { | |
echo "$*" | |
} | |
##PS4='+ LINE:${BASH_SOURCE[0]}:${BASH_FUNCNAME[0]}:${LINENO}: ' |
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 | |
# | |
# Tests the state machine handler. | |
# Define 5 functions, auto-generate a state machine control mechanism to | |
# determine which functions are executed. | |
# | |
# License: MIT Open Source | |
# Copyright (c) 2018 by Joe Linoff | |
source state-machine.sh |
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 | |
# | |
# Tests the state machine handler. | |
# Define 5 functions, auto-generate a state machine control mechanism to | |
# determine which functions are executed. | |
# | |
# License: MIT Open Source | |
# Copyright (c) 2018 by Joe Linoff | |
source state-machine.sh |
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 | |
''' | |
Find all IPv4 addresses on a line and replace the interesting | |
ones. | |
Interesting IP addresses are those that are not in the exclude | |
list. | |
''' | |
# License: MIT Open Source | |
# Copyright (c) 2018 by Joe Linoff |
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 | |
# | |
# Copyright (c) 2017 by Joe Linoff | |
# MIT Open Source License. | |
# | |
# This script shows how to implement an argument parser with | |
# 4 options. Two of the options are simply flags, one of | |
# of them has a single argument and the other has 2 arguments. | |
# | |
# It is meant to show bash can support reasonably complex |
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 | |
# | |
# Purge all but the last N files in the input list. | |
# | |
if (( $# > 1 )) ; then | |
readonly NUM=$1 | |
shift | |
readonly LIST=($*) | |
readonly LEN=$(( ${#LIST[@]} - $NUM )) | |
if (( LEN )) ; then |
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 | |
# | |
# Fix the first line of python a file to point to the | |
# new python interpreter. | |
# | |
# This mess required to make sure that script works on | |
# the Mac. Normally we would just use readlink. | |
set -e | |
RootDir=$(cd $(dirname $0) && pwd) | |
source $RootDir/libutils.sh |