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
Pastekan adalah website paste kode / teks sederhana

Pastekan pastekan adalah website paste kode / teks sederhana. install pip install pastekan penggunaan pastekan myfile.txt atau echo "hi" | pastekan

Sekai Kode 1 Dec 24, 2021
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
Example of a CLI with python - know the extension of your files.

extensionCLI Example of a CLI with python - know the extension of your files. Usage: Install the CLI: pip3 install -e . Run the command with "ext" + t

ItanuRomero 5 Dec 29, 2022
A mini command line tool to spellcheck text files using tadqeek.alsharekh.org

tadqeek_sakhr A mini command line tool to spellcheck text files using tadqeek.alsharekh.org Usage usage: python tadqeek_sakhr.py [-h] -i INPUT [-o OUT

Youssif Shaaban Alsager 5 Dec 11, 2022
Browse Hacker News like a haxor: A Hacker News command line interface (CLI).

haxor-news Coworker who sees me looking at something in a browser: "Glad you're not busy; I need you to do this, this, this..." Coworker who sees me s

Donne Martin 3.8k Jan 07, 2023
Python implementation of SSH file transfer across servers.

SSH Transfer Python implementation of SSH file transfer across servers. Requirements paramiko=2.7.2 Usage Config Preparation Configure some informatio

Zhe Kong 1 Nov 23, 2021
A command line interface to buy things in stregsystemet

Stregsystemet-CLI This repository is the Stregsystemet CLI, to buy things in Stregsystemet, at AAU. Use of this cli-tool is at your own risk and there

F-klubben 14 Oct 18, 2022
CLI para o projeto Compilado (Newsletter e Podcast do Código Fonte TV)

Compilado CLI Automatização de tarefas através de linha de comando para a geração de assets para episódios do Compilado, a newsletter e podcast do can

Gabriel Froes 18 Nov 21, 2022
A command-line tool to upload local files and pastebin pastes to your mega account, without signing in anywhere

A command-line tool to upload local files and pastebin pastes to your mega account, without signing in anywhere

ADI 4 Nov 17, 2022
A python Ethereum utilities command-line tool.

peth-cli A python Ethereum utilities command-line tool. After wasting the all day trying to install seth and failed, I took another day to write this.

Moon 55 Nov 15, 2022
Simple command-line implementation of minesweeper

minesweeper This is a Python implementation of 2-D Minesweeper! Check out the tutorial here: https://youtu.be/Fjw7Lc9zlyU You start a game by running

Kylie 49 Dec 10, 2022
This is a simple Termo application in command line style

my-termo This is a simple Termo application in command line style. This app run a Linux crontab task every day to get a new word. Type termo in your t

Gustavo Soares 1 Feb 14, 2022
nbcommands bring the goodness of Unix commands to Jupyter notebooks.

nbcommands nbcommands bring the goodness of Unix commands to Jupyter notebooks. Installation You can simply use pip to install nbcommands: $ pip insta

Vinayak Mehta 181 Dec 23, 2022
The project help you to quickly build layouts in terminal,cross-platform

The project help you to quickly build layouts in terminal,cross-platform

gojuukaze 133 Nov 30, 2022
A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool

Privateer A simple CLI based any Download Tool, that find files and let you stream or download thorugh WebTorrent CLI or Aria or any command tool How

Shreyash Chavan 2 Apr 04, 2022
Kattis shell for getting examples, testing and submitting.

Kattis shell for getting examples, testing and submitting.

Simon Green Kristensen 15 Sep 30, 2022
TerminalGV is a very simple client to display stats about your SNCF TGV/TER train in your terminal.

TerminalGV So I got bored in the train, TerminalGV is a very simple client to display stats about your SNCF TGV/TER train in your terminal. The "on-tr

Samuel 8 Dec 15, 2022
A terminal application for managing images and artifacts in Azure Container Registry.

acr-browser acr-browser is a terminal-based user interface for managing container images and artifacts in Azure Container Registry. 🚀 This project ow

Sam Dobson 5 Jul 30, 2022
Custom function scheduler TUI (text-based user interface) in the console

Custom function scheduler TUI (text-based user interface) in the console

Luke 1 Oct 26, 2022
🗃️ Fileio-cli wrapper for fileioapi.py with fire.py, inspiration DOS

🗃️ File.io File.io simply upload a file, share the link, and after it is downloaded, the file is completely deleted. An API wrapper for the file.io w

nkot56297 2 May 12, 2022