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
| # Copy from standard input into the clipboard. | |
| alias copy='xsel --clipboard --input' | |
| # Dump clipboard content to the standard output. | |
| # Called `pasta` and not `paste` because `paste` already exists and can be useful. | |
| alias pasta='xsel --clipboard --output' |
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 | |
| # Prefix stdin lines with current date and time. | |
| # Sample usage: | |
| # tail -f some/file.log |predate | |
| # Any given arguments are provided to date(1): | |
| # tail -f some/file.log |predate -u -Ins | |
| while read line | |
| do |
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 | |
| # INSTALLATION: | |
| # Drop this file in your PATH, name it `ghopen` and give it executable permission. | |
| # | |
| # You can set up the `GHOPEN_BROWSER` env var to define which browser to open. | |
| # Example values: 'google-chrome' (default), 'firefox'… | |
| # ----- | |
| # USAGE: | |
| # Just run `ghopen` inside a Git repository having a GitHub remote. |
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 | |
| # Installation: | |
| # - Download this file. | |
| # - Name it `missinglines`. | |
| # - Make it executable (`chmod +x missinglines`). | |
| # - Move it to your PATH. | |
| set -o errexit |
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 | |
| video_file_path="$1" | |
| from="$2" | |
| to="$3" | |
| set -error | |
| tmpdir_path="${TMPDIR:-/tmp}/" |
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 | |
| # Output lines of stdin from $1 to $2. | |
| # $1 and $2 can be line numbers or patterns. Examples: | |
| # slice 10 20 # keep lines 10 to 20 | |
| # slice /foo/ /bar/ # keep lines from the one matching foo to the one matching bar. | |
| # slice 31703 '/<\/Product>/' # keep lines from number 31703 to the first one matching </Product> | |
| sed "$1,$2!d" - |
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 | |
| if [[ $* == *-h* ]]; then | |
| cat <<USAGE | |
| Switch between full and low brightness using xbacklight. | |
| sween [low-brightness] | |
| low-brightness defaults to 5, and is a percentage. | |
| USAGE | |
| exit 1 |
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 -eu | |
| sed -r 's/^[[:blank:]]+//' |
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 | |
| usage() { echo "Usage: hr [-h] [-c <CHAR (defaults to '=')>] [<LINES (defaults to 1)>]" 1>&2; exit 1; } | |
| CHAR='=' | |
| while getopts "h c:" ARG; do | |
| case $ARG in | |
| c) | |
| CHAR="$OPTARG" |
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 | |
| # Make this file executable: `chmod +x git-rt`. | |
| # Then move it to a PATH directory to be able to run it as a Git subcommand (`git rt`). | |
| set -eu | |
| function status_val() { | |
| local property="${@:$#}" # last parameter | |
| local status_opts="${@:1:$#-1}" # all parameters except the last |