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 | |
# | |
# Shell scripts for get image manifest from v2 registry | |
# | |
# Tested on Debian 8, curl 7.38.0, jq-1.5 | |
# | |
set -e -u | |
# Default tag is latest |
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 | |
# | |
# Shell scripts for get image manifest from v2 registry | |
# | |
# Tested on Debian 8, curl 7.38.0, jq-1.5 | |
# | |
set -e -u | |
# Default tag is latest |
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 | |
# Save docker images | |
ds() { | |
docker images --format {{.Repository}}:{{.Tag}} | xargs -t -n 1 -I {} -P 4 sh -c 'docker save {} > $(echo "{}" | sed "s/^.*\///").tar.gz' | |
} | |
# Load docker images | |
dl() { | |
ls *.tar.gz | xargs -t -n 1 -I {} -P 4 sh -c 'docker load -i {}' |
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/sh | |
set -o pipefail | |
set +o xtrace | |
red=$(tput setaf 1) | |
green=$(tput setaf 2) | |
reset=$(tput sgr0) | |
function os_type() { |
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
def bytes2human(in_bytes: int) -> str: | |
''' | |
''' | |
suffixes = ('B', 'KB', 'MB', 'GB', 'TB', 'PB') | |
suffix = 0 | |
while in_bytes > 9999 and suffix < len(suffixes): | |
in_bytes = in_bytes >> 10 | |
suffix += 1 | |
if suffix >= len(suffixes): |
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
func bytes2human(inBytes int64) (result string) { | |
suffixes := []string{"B", "KB", "MB", "GB", "TB", "PB"} | |
suffix := 0 | |
for inBytes > 9999 && suffix < len(suffixes) { | |
inBytes = inBytes >> 10 | |
suffix++ | |
} | |
if suffix >= len(suffixes) { | |
suffix-- |
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 __curl() { | |
read proto server path <<<$(echo ${1//// }) | |
DOC=/${path// //} | |
HOST=${server//:*} | |
PORT=${server//*:} | |
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80 | |
exec 3<>/dev/tcp/${HOST}/$PORT | |
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3 | |
(while read line; do |
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 | |
__version__ = "0.7" | |
__all__ = ["SimpleHTTPRequestHandler"] | |
import argparse | |
import http.server | |
from html import escape | |
from io import BytesIO | |
from mimetypes import add_type, guess_type, init, inited |