I created this Gist simply for testing https://gist.io.
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 bash | |
| # Overview | |
| # ---- | |
| # The following script is used for migrate a Git repository containing lots of binary file | |
| # to use Git LFS. | |
| # | |
| # This script incorporates all steps described in the article "Convert Git to Git LFS" [1]. | |
| # | |
| # Prerequisites: |
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 bash | |
| set -e | |
| # Heavily copied from https://stackoverflow.com/questions/43235179/how-to-execute-ssh-keygen-without-prompt. | |
| # Generate a SSH key using Ed25519 (instead of RSA) without a passphrase. | |
| # The command will run silently. | |
| ssh-keygen -o -t ed25519 -f /tmp/test.pem -N '' <<<y 2>&1 >/dev/null |
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 jshell | |
| import java.io.InputStream; | |
| import java.io.OutputStream; | |
| import java.security.MessageDigest; | |
| import java.security.DigestInputStream; | |
| /** | |
| * A super elegant way to produce a `InputStream` at any size using an iterating | |
| * approach (Stream-like). | |
| * This was copied from https://www.nurkiewicz.com/2014/07/building-extremely-large-in-memory.html |
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
| const util = require('util'); | |
| const stream = require('stream'); | |
| const pipeline = util.promisify(stream.pipeline); | |
| const Readable = stream.Readable; | |
| const PassThrough = stream.PassThrough; | |
| const {randomBytes} = require('crypto'); | |
| // const RandomStream = function(options) { | |
| // const { | |
| // sizeInBytes, |
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 bash | |
| set -ueo pipefail | |
| # | |
| # This script is for converting .DAV video file created by CCTV camera [1] to .MP4. | |
| # | |
| # The script was used by me personally for converting the recorded video by an Android | |
| # app gDMSS Lite to MP4. Tested mainly on MacOS Catalina. | |
| # |
Zekkelkasten - https://en.wikipedia.org/wiki/Zettelkasten
P.A.R.A - https://fortelabs.co/blog/para/
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 bash | |
| docker_hub_rate_limit_check() { | |
| # This function is implemented following instructions in Docker's guide. | |
| # Usage is simple: | |
| # - Run the function to verify the Rate Limit of your current IP (anonymous). | |
| # - Passing with "username:password" to verify Rate Limit of your Docker Hub | |
| # account. | |
| # |
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 bash | |
| # Do `cd ..` by x times. | |
| # function back() { for x in {1..${1:-1}}; do cd ..; done } | |
| # | |
| back() { | |
| local target="${1:-1}" | |
| local full_path="$(pwd)" | |
| # The script supports |