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 static java.util.Objects.requireNonNull; | |
public class Base64Util { | |
private static final double BASE64_SIZE_RATIO = 4.0d / 3; | |
private Base64Util() { | |
} | |
/** | |
* Computes the expected decoded byte size of the base64 encoded data. |
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() { | |
cat << EOF | |
usage: $0 volume-name archive-file | |
e.g. $0 gitlab_config /home/coal/gitlab_config.tar.gz | |
EOF | |
exit 1 |
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 | |
backup_file() { | |
if [ "$#" -ne 3 ]; then | |
echo "error: 3 parameters required" | |
echo usage $0 [source-container-name] [source-file] [s3-object-destination] | |
echo | |
exit 1 | |
fi |
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() { | |
cat << EOF | |
usage: $0 [container-name] [source-directory] [s3-object-destination] | |
e.g. $0 nginx /etc/nginx/ s3://bucket/nginx-etc.tgz | |
EOF | |
exit 1 | |
} |
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
# initial clone ane mirror | |
git clone --bare --mirror /uri/to/[fromrepo.git] | |
cd [fromrepo.git] | |
git remote add --mirror=push mirror /uri/to/[to_repo.git] | |
git push mirror | |
# update mirror | |
git remote update --prune origin | |
git push mirror |
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 memoize from 'lodash.memoize'; | |
const cache = memoize(req => { | |
return fetch(req).then(response => { | |
return response; | |
}); | |
}, req => req.url); | |
function cacheFetch(input, init) { | |
return cache(new Request(input, init)).then(response => response.clone()); |