Thanks to visit codestin.com
Credit goes to github.com

Skip to content

kljensen/s3clipboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

S3 Clipboard

shellcheck

Table Of Contents

Project description:

s3clipboard is a small, Posix-compliant shell script for using S3 as a clipboard register. This lets you "copy" from one machine and "paste" on another. You can optionally encrypt the contents of the clipboard with a symmetric cipher using openssl. This project is similar to sqs_clipboard but it uses S3 instead of SQS and it is shell script instead of a Go binary.

Installation

You can either install this project by checking out the git repo

git clone https://github.com/kljensen/s3clipboard.git

Or by downloading the s3clipboard shell script directly

curl -O https://raw.githubusercontent.com/kljensen/s3clipboard/main/s3clipboard

Or, if you are a homebrew user, you can install s3clipboard via the kljensen/tap tap using either

brew install kljensen/tap/s3clipboard

or

brew tap kljensen/tap
brew install s3clipboard

Requirements/Dependencies:

Example Usage

The shell script has two commands: copy and paste. The copy command will read stdin and write it to an object on S3. The paste command will read an object on S3 and write it to stdout.

Usage: ./s3clipboard [-e] [-p PASSWORD] [-b BUCKET] [-o OBJECT_KEY] (copy|paste)

The -e flag turns on encryption, which requires an OpenSSL implementation. You may optionally specify a password with -p. If you specify -e without -p you will be prompted for a password. The -a allows you to select a named AWS profile.

You can specify your destination bucket on S3 using the -b flag and your destination object within that bucket with the -o flag.

The script also reads a number of environment variables.

Environment Variable Meaning
S3CLIPBOARD_ENCRYPT Non-empty value or -e turns on encryption.
S3CLIPBOARD_PASSWORD Non-empty value or -p argument sets encryption password.
S3CLIPBOARD_BUCKET Non-empty value or -b argument sets S3 bucket.
S3CLIPBOARD_OBJECT Non-empty value or -o argument sets the S3 object within the bucket.
S3CLIPBOARD_AWS_PROFILE Non-empty value or -a argument sets the named AWS profile.

The shell session below shows copying and pasting to and from S3.

> export S3CLIPBOARD_BUCKET="my-favorite-bucket"
> export S3CLIPBOARD_ENCRYPT="true"
> export S3CLIPBOARD_PASSWORD="my-secret-pass"
> echo "my secret content" | ./s3clipboard copy
> ./s3clipboard paste
my secret content

Contributing

All issues and pull requests are welcome. I ask only that you run ShellCheck before submitting a pull request.

Change Log

CHANGELOG.md

License

See the LICENSE file.

About

A shared clipboard to copy and paste between machines using S3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages