dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 12449bc78d31816b52c2d164c89944dce491eb60
parent c862c464e3f433bdb1fa88ee88371935c5e04ff7
Author: Anders Damsgaard <andersd@riseup.net>
Date:   Wed,  6 Sep 2017 12:47:45 -0400

add function to transfer.sh for sharing of large files

Diffstat:
M.zshrc | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/.zshrc b/.zshrc @@ -140,6 +140,23 @@ alias date-eastern='eastern-date' alias date-pacific='pacific-date' function define() { curl --silent dict://dict.org/d:$1 } +# use transfer.sh to share files over the net +function transfer() { + if [ $# -eq 0 ]; then + echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md" + return 1 + fi + tmpfile=$( mktemp -t transferXXX ) + if tty -s; then + basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g') + curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile + else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile + fi + cat $tmpfile + rm -f $tmpfile +} + + # enable color support of ls and also add handy aliases if [[ "$ARCH" != 'Darwin' ]]; then alias ls='ls --color=auto -F'