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
function get_remote_digest() { | |
local repo="${1}" | |
local tag="${2}" | |
local token | |
token=$(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:${repo}:pull" | jq -r '.token') | |
digest="$(curl -I -s -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -H "Authorization: Bearer $token" "https://registry-1.docker.io/v2/${repo}/manifests/${tag}" | sed 's/: /=/g' | grep -i docker-content-digest | cut -d= -f2 | tr -d '\r')" | |
echo "${digest}" | |
} |
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 bash | |
function get_access_token(){ | |
set -euo pipefail | |
local key_json_file="${1}" | |
local scope="${2}" | |
local valid_for_sec="${3:-3600}" | |
local jwt_token | |
jwt_token=$(create_jwt_token "${key_json_file}" "${scope}" "${valid_for_sec}") |
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 random | |
def assign_random_num_to_soldier(top: int) -> list: | |
random_number_list = list() | |
for _ in range(top): | |
random_number_list.append(random.randint(1, top)) | |
return random_number_list | |