added keybase sample, updated transfer alias

This commit is contained in:
Remco 2014-11-16 12:11:20 +01:00
parent 4a87172bc9
commit f60b0ef80c
4 changed files with 132 additions and 24 deletions

View file

@ -70,7 +70,7 @@
<br>$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt https://transfer.sh/66nb8/hello.txt <br>$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt https://transfer.sh/66nb8/hello.txt
<br> <br>
<br> <br>
<span class="code-title"># Create an alias</span> <span class="code-title"># Using the alias</span>
<br>$ transfer hello.txt <br>$ transfer hello.txt
<br>##################################################### 100.0% https://transfer.sh/eibhM/hello.txt <br>##################################################### 100.0% https://transfer.sh/eibhM/hello.txt
</code> </code>
@ -165,16 +165,30 @@
</div> </div>
</div> </div>
<div class="col-md-6 "> <div class="col-md-6 ">
<h3>Create an alias and add it to .bashrc or .zshrc</h3> <h3>Create an alias and add it to .bashrc or .zshrc <a href='https://gist.github.com/nl5887/a511f172d3fb3cd0e42d'>[gist]</a></h3>
<div class="terminal-top"> <div class="terminal-top">
</div> </div>
<div class="terminal"> <div class="terminal">
<code> <code>
<span class="code-title"># Add this to .bashrc or its equivalent</span> <span class="code-title"># Add this to .bashrc or its equivalent</span>
<br/>transfer() { <br/>transfer() {
<br># write to output to tmpfile because of progress bar <br/> if [ $# -eq 0 ]; then
<br>tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g') <br/> echo "No arguments specified. Usage:"
<br/>curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile <br/> echo "$ transfer /tmp/test.md"
<br/> echo "$ cat /tmp/test.md | transfer test.md"
<br/> return 1
<br/> fi
<br/>
<br/> # write to output to tmpfile because of progress bar
<br/> tmpfile=$( mktemp -t transferXXX );
<br/>
<br/> if tty -s; then
<br/> basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
<br/> curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
<br/> else
<br/> curl --progress-bar --upload-file "-" "https://transfer.sh/$1"
<br/> fi
<br/>
<br/> cat $tmpfile; rm -f $tmpfile; <br/> cat $tmpfile; rm -f $tmpfile;
<br/>} <br/>}
<br/> <br/>
@ -268,6 +282,23 @@
</code> </code>
</div> </div>
</div> </div>
<div class="col-md-6">
<h3>Using <a href="https://keybase.io/">Keybase.io</a></h3>
<div class="terminal-top">
</div>
<div class="terminal">
<code>
<span class="code-title"># Import keys from keybase</span>
<br/>$ keybase track [them]
<span class="code-title"># Encrypt for recipient(s)</span>
<br/>$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt
<span class="code-title"># Decrypt</span>
<br/>$ curl https://transfer.sh/sqUFi/test.md |keybase decrypt
</code>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h3>Send us your awesome example</h3> <h3>Send us your awesome example</h3>
<div class="terminal-top"> <div class="terminal-top">

View file

@ -11,7 +11,17 @@ $ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.
Download & decrypt: Download & decrypt:
$ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt $ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt
Upload to virustotal: Using Keybase:
# import keys from keybase
$ keybase track [them]
# encrypt for recipients
$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt
# decrypt
$ curl https://transfer.sh/sqUFi/test.md |keybase decrypt
Upload to Virustotal:
$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal
Virusscan: Virusscan:
@ -20,10 +30,23 @@ $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/scan
Add alias to .bashrc or .zshrc: Add alias to .bashrc or .zshrc:
=== ===
transfer() { transfer() {
if [ $# -eq 0 ]; then
echo "No arguments specified. Usage:"
echo "$ transfer /tmp/test.md"
echo "$ cat /tmp/test.md | transfer test.md"
return 1
fi
# write to output to tmpfile because of progress bar # write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transferXXX ); tmpfile=$( mktemp -t transferXXX );
if tty -s; then
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
else
curl --progress-bar --upload-file "-" "https://transfer.sh/$1"
fi
cat $tmpfile; rm -f $tmpfile; cat $tmpfile; rm -f $tmpfile;
} }

View file

@ -44,7 +44,7 @@ include "includes/head.html"
<br>$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt https://transfer.sh/66nb8/hello.txt <br>$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt https://transfer.sh/66nb8/hello.txt
<br> <br>
<br> <br>
<span class="code-title"># Create an alias</span> <span class="code-title"># Using the alias</span>
<br>$ transfer hello.txt <br>$ transfer hello.txt
<br>##################################################### 100.0% https://transfer.sh/eibhM/hello.txt <br>##################################################### 100.0% https://transfer.sh/eibhM/hello.txt
</code> </code>
@ -139,16 +139,30 @@ include "includes/head.html"
</div> </div>
</div> </div>
<div class="col-md-6 "> <div class="col-md-6 ">
<h3>Create an alias and add it to .bashrc or .zshrc</h3> <h3>Create an alias and add it to .bashrc or .zshrc <a href='https://gist.github.com/nl5887/a511f172d3fb3cd0e42d'>[gist]</a></h3>
<div class="terminal-top"> <div class="terminal-top">
</div> </div>
<div class="terminal"> <div class="terminal">
<code> <code>
<span class="code-title"># Add this to .bashrc or its equivalent</span> <span class="code-title"># Add this to .bashrc or its equivalent</span>
<br/>transfer() { <br/>transfer() {
<br># write to output to tmpfile because of progress bar <br/> if [ $# -eq 0 ]; then
<br>tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g') <br/> echo "No arguments specified. Usage:"
<br/>curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile <br/> echo "$ transfer /tmp/test.md"
<br/> echo "$ cat /tmp/test.md | transfer test.md"
<br/> return 1
<br/> fi
<br/>
<br/> # write to output to tmpfile because of progress bar
<br/> tmpfile=$( mktemp -t transferXXX );
<br/>
<br/> if tty -s; then
<br/> basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
<br/> curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
<br/> else
<br/> curl --progress-bar --upload-file "-" "https://transfer.sh/$1"
<br/> fi
<br/>
<br/> cat $tmpfile; rm -f $tmpfile; <br/> cat $tmpfile; rm -f $tmpfile;
<br/>} <br/>}
<br/> <br/>
@ -242,6 +256,23 @@ include "includes/head.html"
</code> </code>
</div> </div>
</div> </div>
<div class="col-md-6">
<h3>Using <a href="https://keybase.io/">Keybase.io</a></h3>
<div class="terminal-top">
</div>
<div class="terminal">
<code>
<span class="code-title"># Import keys from keybase</span>
<br/>$ keybase track [them]
<span class="code-title"># Encrypt for recipient(s)</span>
<br/>$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt
<span class="code-title"># Decrypt</span>
<br/>$ curl https://transfer.sh/sqUFi/test.md |keybase decrypt
</code>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h3>Send us your awesome example</h3> <h3>Send us your awesome example</h3>
<div class="terminal-top"> <div class="terminal-top">

View file

@ -11,7 +11,17 @@ $ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.
Download & decrypt: Download & decrypt:
$ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt $ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt
Upload to virustotal: Using Keybase:
# import keys from keybase
$ keybase track [them]
# encrypt for recipients
$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt
# decrypt
$ curl https://transfer.sh/sqUFi/test.md |keybase decrypt
Upload to Virustotal:
$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal
Virusscan: Virusscan:
@ -20,10 +30,23 @@ $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/scan
Add alias to .bashrc or .zshrc: Add alias to .bashrc or .zshrc:
=== ===
transfer() { transfer() {
if [ $# -eq 0 ]; then
echo "No arguments specified. Usage:"
echo "$ transfer /tmp/test.md"
echo "$ cat /tmp/test.md | transfer test.md"
return 1
fi
# write to output to tmpfile because of progress bar # write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transferXXX ); tmpfile=$( mktemp -t transferXXX );
if tty -s; then
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
else
curl --progress-bar --upload-file "-" "https://transfer.sh/$1"
fi
cat $tmpfile; rm -f $tmpfile; cat $tmpfile; rm -f $tmpfile;
} }