Skip to content

Instantly share code, notes, and snippets.

@maksadbek
Created February 8, 2019 17:26
Show Gist options
  • Save maksadbek/a07a4063b9e259e697ba5503da3ea665 to your computer and use it in GitHub Desktop.
Save maksadbek/a07a4063b9e259e697ba5503da3ea665 to your computer and use it in GitHub Desktop.
Pretty print json from clipboard and open in vim
#!/bin/bash
randname=$(LC_ALL=C cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 5 | head -n 1)
randname="$(date "+%d_%m_%y_")$randname"
randfile="/tmp/$randname"
echo $randname
pbpaste | jq . > $randfile && vim $randfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment