A simple command for converting and processing data from your clipboard.

Overview

Poly

A simple command for converting and processing data from your clipboard.

Installation

Unix-based Install Script

NOTE: NEVER BLINDLY RUN ANY SCRIPT THAT ASKS FOR sudo!
Please inspect the file first by viewing the raw file from the URL in the command below before piping it to /bin/bash.

The install script needs sudo for copying the script into /usr/bin and setting it to be executable.

sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/3digitdev/poly/master/install.sh)"

(requires sudo permission, also will prompt to install Python packages):

Windows Support [FUTURE]

This script is not designed to support Windows at this time.

Feel free to make a PR to add support and install instructions!

Usage

This script will expect you to have the text it will manipulate in your clipboard. When you run a command, it will do its job, and if it is successful, it will put the modified text back into your clipboard, as well as send it to stdout.

You can generally convert data with the following format:

poly [ options]

Any other generic command is simply

poly [ options]

You can find some basic help from the --help option at any level:

poly --help
poly json --help
poly yaml --help
...etc

Chat Copypasta

A slowly-expanding list of chat programs to copy/paste out of into a more sane a readable format (thanks, emoji reactions...)

The intention is for each command to support both the webapp and the desktop client for each of the chat programs (Yes, they copy differently. No, you shouldn't be surprised.)

Supported chat program(s):

  • Slack

Future support:

  • Discord
  • MS Teams

Conversions

All of the following formats convert between each other:

  • JSON
  • YAML
  • TOML
  • JWT
  • URL Query String (see below for what this means)

NOTE: Some data types (like null in TOML) won't convert and might be dropped!

Additionally, you can convert between color formats:

  • Hex (e.g. #123, #123456, #1234, #12345678)
  • RGB (e.g. (10, 10, 10), (5,5,5))
  • RGBA (e.g. (10, 10, 10, 10), (5,5,5,5))

JWT Conversion

Converting to JWT requires two additional options:

  • -s, --secret: A secret string to encode/decode with
  • -a, --algorithm: An algorithm to encode/decode with

URL Query String Type Conversion

When converting from a query string you can use the -c, --convert flag to tell poly to attempt to convert all the values in the query string. They all start as strings, but it will attempt to do things like convert "true" to true for JSON/YAML, etc. This only works for the basic data types; it will not do anything smart like nested objects/lists.

Example:

assuming your clipboard contains a=1&b=true&c=a,b,c...

poly query-string json --convert

will result in

{
  "a": 1,
  "b": true,
  "c": "a,b,c"   // note that this is NOT ["a", "b", "c"]
}

?foo=bar,baz,bat will be converted as a string of {"foo": "bar,baz,bat"}, not as a list of {"foo": ["bar", "baz", "bat"]} If you want a list to be built, simply use the same query param multiple times.

More complex example (including list and complex object):

assuming your clipboard contains

http://foo.bar.com?a=1&b=true&c=a,b,c&b=false&d={"foo":"bar"}

(note that this contains a url! oooooo....)

running:

poly query-string json --convert --include-url

will result in:

{
  "url": "http://foo.bar.com",  // from --include-url
  "a": 1,
  "b": [true, false],  // multiple 'b' params were combined into a list
  "c": "a,b,c",   // note that this is NOT ["a", "b", "c"]
  "d": {"foo": "bar"}   // oooooo fancy
}

This is all done using the Python builtin ast.literal_eval() -- a completely safe function that will attempt simply to convert the string to a valid Python literal, but does not execute the string as code.

JSON formatting (json)

Manipulate JSON data from the clipboard

All commands start with poly json

  • pretty: pretty-prints the JSON in your clipboard and sends it back to the clipboard
  • one-line: outputs the JSON in your clipboard as a single line of text and sends it back to the clipboard

Base64 (b64)

Encode/Decode Base64 data

  • poly b64 from: Takes base64-encoded data from the clipboard, outputs the decoded data, and sends it back to the clipboard
  • poly b64 to: Takes data from the clipboard, outputs base64-encoded data, and sends it back to the clipboard

Hash Functions

Supports md5, sha1, sha256, and sha512

URL Query Param Encoding/Decoding

  • poly url encode
  • poly url decode

Encodes strings like

a=1&b=true&c=a,b,c&b=false&d={"foo": "bar", "baz": "bat"}

into

a=1&b=true&b=false&c=a%2Cb%2Cc&d=%7B%22foo%22%3A%20%22bar%22%2C%20%22baz%22%3A%20%22bat%22%7D

and decodes them back again.

Both encode/decode also support -q, --quote-plus which allows for encoding spaces as + instead of %20

String Manipulation

  • Line sorting (line-sort): This will attempt to sort the lines of a \n-separated string in your clipboard
  • Spongebob (sponge, spongebob): I WoNDeR What ThIS doEs
  • Smart Quotes (quotes): Replaces those stupid β€œ/”/β€˜/’ with proper quotes "/'
  • [Un]Escape Text (escape/unescape): Add/remove \ in a string for given characters
Owner
3DigitDev
3DigitDev
This is the public repo for the VS Code Extension AT&T i386/IA32 UIUC-ECE391 Syntax Highlighting

AT&T i386 IA32 UIUC ECE391 GCC Highlighter & Snippet & Linter This is the VS Code Extension for UIUC ECE 391, MIT 6.828, and all other AT&T-based i386

Jackgetup 1 Feb 05, 2022
pyGinit is a command line tools that help you to initialize your current project a local git repo and remote repo

pyGinit pyGinit is a command line tools that help you to initialize your current project a local git repo and remote repo Requirements Requirements be

AlphaBeta 15 Feb 26, 2022
Unconventional ways to save an Image

Unexpected Image Saves Unconventional ways to save an image πŸ˜„ Have you ever been bored by the same old .png, .jpg, .jpeg, .gif and all other image ex

Eric Mendes 15 Nov 06, 2022
πŸ‘» Ghoul is an easy to use information service, allowing you to get/add information on someone or something directly from your terminal.

πŸ‘» Ghoul is an easy to use information service, allowing you to get/add information on someone or something directly from your terminal. It c

Billy 11 Nov 10, 2021
Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.

i love my dog 2.8k Jan 05, 2023
Terminal epub reader with inline images

nuber Inspired by epy, nuber is an Epub terminal reader with inline images written with Rust and Python using Überzug. Features Display images in term

Moshe Sherman 73 Oct 12, 2022
Palm CLI - the tool-belt for data teams

Palm CLI: The extensible CLI at your fingertips Palm is a universal CLI developed to improve the life and work of data professionals. Palm CLI documen

Palmetto 41 Dec 12, 2022
Write Django management command using the click CLI library

Django Click Project information: Automated code metrics: django-click is a library to easily write Django management commands using the click command

Jonathan Stoppani 215 Dec 19, 2022
Microsoft Azure CLI - Azure Command-Line Interface

A great cloud needs great tools; we're excited to introduce Azure CLI, our next generation multi-platform command line experience for Azure.

Microsoft Azure 3.4k Dec 30, 2022
split-manga-pages: a command line utility written in Python that converts your double-page layout manga to single-page layout.

split-manga-pages split-manga-pages is a command line utility written in Python that converts your double-page layout manga (or any images in double p

Christoffer Aakre 3 May 24, 2022
cmsis-pack-manager is a python module, Rust crate and command line utility for managing current device information that is stored in many CMSIS PACKs

cmsis-pack-manager cmsis-pack-manager is a python module, Rust crate and command line utility for managing current device information that is stored i

pyocd 20 Dec 21, 2022
Tidier - a simple command line tool that helps you make your files tidy up

Tidier - a simple command line tool that helps you make your files tidy up

AmirMohammad Hosseini Nasab 8 Aug 16, 2022
This a simple tool to query the awesome ippsec.rocks website from your terminal

ippsec-cli This a simple tool to query the awesome ippsec.rocks website from your terminal Installation and usage cd /opt git clone https://github.com

stark0de 5 Nov 26, 2022
Open-Source Python CLI package for copying DynamoDB tables and items in parallel batch processing + query natural & Global Secondary Indexes (GSIs)

Python Command-Line Interface Package to copy Dynamodb data in parallel batch processing + query natural & Global Secondary Indexes (GSIs).

1 Oct 31, 2021
A terminal client for connecting to hack.chat servers

A terminal client for connecting to hack.chat servers.

V9 2 Sep 21, 2022
:computer: tmux session manager. built on libtmux

tmuxp, tmux session manager. built on libtmux. We need help! tmuxp is a trusted session manager for tmux. If you could lend your time to helping answe

python utilities for tmux 3.6k Jan 01, 2023
Play videos in the terminal.

Termvideo Play videos in the terminal (stdout). python main.py /path/to/video.mp4 Terminal size: -x output_width, -y output_height. Default autodetect

Patrick 11 Jun 13, 2022
This is an app for creating your own color scheme for Termux!

Termux Terminal Theme Creator [WIP] If you need help on how to use the program, you can either create a GitHub issue or join this temporary Discord se

asxlvm 3 Dec 31, 2022
A terminal written in Python.

PyDOS Read the title and then you'll figure out what this actually is. Running First, download or clone this repo. Next, run run.py. After this, you c

TechStudent10 2 Mar 01, 2022
A CLI Application to detect plagiarism in Source Code Files.

Plag Description A CLI Application to detect plagiarism in Source Code Files. Features Compare source code files for plagiarism. Extract code features

default=dev 2 Nov 10, 2022