Best Alternatives for Sharing Code Snippets

It is even possible to generate your code wallpaper with: blur, rotate and colorschemes!


10 Best Alternatives for Sharing Code Snippets

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

mycode.sh


01. ix.io

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.

ix.io

Generated code link: http://ix.io/2eZc


02. sprunge.us

In the same way as the previous one, but even simpler, example of use:

cat mycode.sh | curl -F 'sprunge=<-' http://sprunge.us

ix.io

Generated code link: http://sprunge.us/M3zF8m


03. Hastebin

Hastebin 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.


04. Gist GitHub

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

Gist


05. GitLab Snippets

GitLab Snippets 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. New Snippet GitLab

https://gitlab.com/snippets/1955776


06. paste.sh

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/.


07. Termbin

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

08. InstaCode

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. InstaCode

Generated code link: http://instaco.de/119823

09. Ubuntu PasteBin

It goes without saying that it is from distribution Linux Ubuntu with a clean and professional interface: Ubuntu PasteBin paste Ubuntu PasteBin code

Generated code link: https://paste.ubuntu.com/p/bwqY6XHpqm/

10. 0x0.st

0x0.st 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

Bonus - Carbon

Carbon

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.

Thanks for reading!


development programming tips


Share


YouTube channel

Subscribe


Marcos Oliveira

Marcos Oliveira

Software developer
https://github.com/terroo

Related articles