From 67e5dd7444ba07020860723904418e2b6e0f34b8 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Thu, 27 Apr 2017 10:52:49 -0700 Subject: [PATCH] Add a bunch of new bin files --- assets/default/bin/git-monthly | 36 +++++++++++++++++++++++++++++ assets/default/bin/haste | 7 ++++++ assets/default/bin/pbcopy-remote | 5 ++++ assets/default/bin/pbcopy-tmux | 16 +++++++++++++ assets/default/bin/pbpaste-tmux | 6 +++++ assets/default/bin/tmux-link-window | 3 +++ 6 files changed, 73 insertions(+) create mode 100755 assets/default/bin/git-monthly create mode 100755 assets/default/bin/haste create mode 100755 assets/default/bin/pbcopy-remote create mode 100755 assets/default/bin/pbcopy-tmux create mode 100755 assets/default/bin/pbpaste-tmux create mode 100755 assets/default/bin/tmux-link-window diff --git a/assets/default/bin/git-monthly b/assets/default/bin/git-monthly new file mode 100755 index 0000000..8bf4244 --- /dev/null +++ b/assets/default/bin/git-monthly @@ -0,0 +1,36 @@ +#! /bin/bash + +########################## +# Author: ViViDboarder +# Returns a git log of any commits in the current or given month +########################## + +# TODO: Build help text + +month=$1 +year=$2 + +if [[ "$month" == "" ]]; then + # Get the current month + month=$(date "+%m") +fi + +if [[ "$year" == "" ]]; then + # Get the current year + year=$(date "+%Y") +fi + +# Get the next month +if [[ "$month" == "12" ]]; then + # If December, loop to Jan of next year + nmonth="1" + nyear=$((year + 1)) +else + # Otherwise, next month of this year + nmonth=$((month + 1)) + nyear=$year +fi + +# Get the git log between the target month and the next month +git log --before={${nyear}-${nmonth}-1} --after={${year}-${month}-1} + diff --git a/assets/default/bin/haste b/assets/default/bin/haste new file mode 100755 index 0000000..dd07eca --- /dev/null +++ b/assets/default/bin/haste @@ -0,0 +1,7 @@ +#! /bin/sh + +host="hb.iamthefij.com" + +a=$(cat) +curl -X POST -s -d "$a" https://${host}/documents | awk -v host=$host -F '"' '{print "https://"host"/"$4}' + diff --git a/assets/default/bin/pbcopy-remote b/assets/default/bin/pbcopy-remote new file mode 100755 index 0000000..0d45a6d --- /dev/null +++ b/assets/default/bin/pbcopy-remote @@ -0,0 +1,5 @@ +#! /bin/bash + +# Reads hostname from arg1 and gets echos the tmux buffer over to to pbcopy + +ssh $1 'tmux show-buffer' | pbcopy diff --git a/assets/default/bin/pbcopy-tmux b/assets/default/bin/pbcopy-tmux new file mode 100755 index 0000000..72c2cbc --- /dev/null +++ b/assets/default/bin/pbcopy-tmux @@ -0,0 +1,16 @@ +#! /bin/bash + +# Mimics pbcopy using the tmux buffer instead. To use, put this in your path as pbcopy +# This is useful for yanking to the cliboard buffer in Vim on a remote box + +if [ $# -eq 0 ]; then + read -r clip + while IFS= read -r line; do + clip+=$'\n'"$line" + done +else + clip="$*" +fi +if tmux has &> /dev/null; then + tmux set-buffer "$clip" +fi diff --git a/assets/default/bin/pbpaste-tmux b/assets/default/bin/pbpaste-tmux new file mode 100755 index 0000000..ca8a835 --- /dev/null +++ b/assets/default/bin/pbpaste-tmux @@ -0,0 +1,6 @@ +#! /bin/bash + +# Mimics pbpaste using the tmux buffer instead. To use, put this in your path as pbpaste +# This is useful for putting from cliboard buffer in Vim on a remote box + +tmux show-buffer diff --git a/assets/default/bin/tmux-link-window b/assets/default/bin/tmux-link-window new file mode 100755 index 0000000..9d65874 --- /dev/null +++ b/assets/default/bin/tmux-link-window @@ -0,0 +1,3 @@ +#! /bin/bash + +tmux new-session "tmux link-window -s $*"