A simple utility, but it helps a lot for those who need to constantly make code snippets available, me for example! 😀️. I separated some for you, let’s go to the list!
For some of our usage examples we will use the following file:
vim mycode.sh
#!/usr/bin/env bash
# Code example to shared snippets
# Author: Marcos <terminalroot.com.br>
send_msg(){
tput cnorm
echo -e "\n\e[31;1mBye!\e[m"
exit 127
}
trap send_msg SIGINT
tput civis
while true;
do
echo -en "\r\e[33;1mThis is \e[36mMy Code\e[34m at \e[37m$(date +%d/%m/%Y-%H:%M:%S)\e[m"
done
done
Your code is shared via the command line, for example:
# Sharing a file and getting the link
cat mycode.sh | curl -F 'f:1=<-' ix.io
The output will inform you of the link you can use to share. If you want more ease, create a Shell function for this or use their client available on the same page, in addition to other options, such as saving codes and links when running the command.
Generated code link: http://ix.io/2eZc
In the same way as the previous one, but even simpler, example of use:
cat mycode.sh | curl -F 'sprunge=<-' http://sprunge.us
Generated code link: http://sprunge.us/M3zF8m
It works online, you need to enter (type/paste) your code and click Save 💾
Ctrl + s
. If you want to share your code, just click Just Text 📋️ or hit Ctrl + shift + r
.
You can still use their client via the command line, installing it via gem:
gem install haste
And using as follows:
cat mycode.sh | haste
Generated code link: https://hastebin.com/morovoxegu.bash
There is the possibility for you to use your own server, see more details here.
This is the option and one of the best known, as it has the GitHub brand/advertising . You can share anonymously too or if you are logged in, it is recorded for your user.
There are even customers for him: Lepton and also: Gisto. Another unrelated service is a url shortener: git.io, it only shortens website URLs/addresses related to GitHub, but it works if you want to shorten your snippets and even same long GitHub URL.
You can shorten it via the command line in a personalized way, example:
Edit YOUR_LONG_URL and LETTERS_CUSTOMIZED for specific names if you want.
curl https://git.io/ -i -F "url=YOUR_LONG_URL" -F "code=LETTERS_CUSTOMIZED"
# curl https://git.io/ -i -F "url=https://gist.github.com/terroo/5bafbcb1cc6f4ab922b70fa165e39468" -F "code=mycode.sh"
Generated code link: git.io/mycode.sh
Similar to Gist, however, there is no possibility to create anonymous snippets, you must be logged into your GitLab account. A very beautiful interface!
The codes that the programmers made available to the public can be consulted here.
To create you need to be logged in and go to the + button or the New Snippet button.
https://gitlab.com/snippets/1955776
It also works online and it encrypts your URL, just access the address and type/paste your code and it automatically saves and makes raw
available in the bottom right corner of the screen: https://paste.sh/.
This is a show of the ball, it runs via the command nc
(needs to have netcat installed) and the insertion is very simple, example:
cat mycode.sh | nc termbin.com 9999
This is loko, sharing is via image and you can create Wallpaper and edit your image: rotate, blur, colorschemes and among other options! Worth the click.
Generated code link: http://instaco.de/119823
It goes without saying that it is from distribution Linux Ubuntu with a clean and professional interface:
Generated code link: https://paste.ubuntu.com/p/bwqY6XHpqm/
This is complete, it is not just a code snippet, but a file sharing, url and everything you want within the limit of 512MB.
It is an alternative to transfer.sh. Example of use:
curl -F'file=@mycode.sh 'http://0x0.st
And as a bonus tip, perhaps the most dearest alternative for the guys is Carbon. You can choose color scheme, background color and even save generated image in 3 different resolutions including 4k.
There is no shortage of options, feel free to choose in this alternative world! 😀️ One that I would definitely not recommend would be PasteBin.com, this one generates ‘bad interpreter’ in your code, if you download and use it on Linux.