ProductPromotion
Logo

Open.Source

made by https://0x3d.site

GitHub - wantguns/bin: highly opinionated, minimal pastebin
highly opinionated, minimal pastebin. Contribute to wantguns/bin development by creating an account on GitHub.
Visit Site

GitHub - wantguns/bin: highly opinionated, minimal pastebin

GitHub - wantguns/bin: highly opinionated, minimal pastebin

Bin

A minimal pastebin which also accepts binary files like Images, PDFs and ships multiple clients.

It does not require you to host a SQL server and everything is self-contained in a statically linked binary (the docker image runs on scratch !), which makes it extremely easy to deploy.

Try it out on: https://basedbin.fly.dev

Clients

Web

You can paste

  • Normal Text

  • Paste Images from clipboard:
    clipboard-paste

  • Files by drag and drop:
    drag_n_drop

CLI

cli-usage

Installation

Get the client from this repository or from my deployed paste:

curl -o pst https://bin.wantguns.dev/client
chmod +x pst

or manually copy the following at a file in your path.

#!/bin/bash

# Change the url accordingly
URL="https://basedbin.fly.dev"

FILEPATH="$1"
FILENAME=$(basename -- "$FILEPATH")
EXTENSION="${FILENAME##*.}"

RESPONSE=$(curl --data-binary @${FILEPATH:-/dev/stdin} --url $URL)
PASTELINK="$URL$RESPONSE"

[ -z "$EXTENSION" ] && \
    echo "$PASTELINK" || \
    echo "$PASTELINK.$EXTENSION"

You have the option to remove the /client description / help in the landing page. To show the /client description, run the bin binary with either BIN_CLIENT_DESC env variable or a -c flag. More on arguments later

Usage

It just works.

$ pst somefile.txt
$ cat someimage.png | pst

(Neo)Vim

Installation

  1. Install the CLI client
  2. Append this to your init.vim / vimrc
nnoremap <leader>p :!pst %<CR>

Usage

Use <leader> + p paste.

Server Deployment

Currently, builds for the following target triples are shipped:

  • x86_64-unknown-linux-gnu (amd64)
  • aarch64-unknown-linux-gnu (arm64)

The builds shipped are statically linked, so you don't even need a libc to run the binary !
The docker manifest labelled wantguns/bin:latest includes the images for both amd64 and arm64 images.

Docker

$ docker run -p 6162:6162 wantguns/bin

Docker Compose

version: '3.3'
services:
  pastebin:
    image: wantguns/bin
    container_name: pastebin
    ports:
      - 127.0.0.1:6163:6163
    environment:
      - BIN_PORT=6163 # Defaults to 6162
      - BIN_LIMITS={form="16 MiB"}
      - BIN_CLIENT_DESC=placeholder
    volumes:
      - ./upload:/upload  # upload folder will have your pastes

Manual

  • Grab a copy of the binary from GH releases
    OR
  • Build on your own:
# A statically linked build
$ cargo build --release
  • Execute the binary as is, no extra shenanigans needed:
$ ./bin

Usage

USAGE:
    bin [OPTIONS]

OPTIONS:
    -a, --address <ADDRESS>
            Address on which the webserver runs [default: 127.0.0.1]

    -b, --binary-upload-limit <BINARY_UPLOAD_LIMIT>
            Binary uploads file size limit (in MiB) [default: 100]

    -c, --client-desc
            Include client description [env: CLIENT_DESC=]

    -h, --help
            Print help information

    -p, --port <PORT>
            Port on which the webserver runs [default: 6162]

    -u, --upload <UPLOAD>
            Path to the uploads folder [default: ./upload]

    -V, --version
            Print version information

Configuration

This pastebin utilizes a custom configuration provider from Rocket. Apart from the essential arguments, you can also use environment variables, which have the highest preference in order.

Everything from the official Rocket doc is supported, just that you have to prefix the env variable with "BIN_":

BIN_PORT=6163
BIN_ADDRESS=0.0.0.0
BIN_LIMITS={form="16 MiB"}
BIN_WORKERS=8
BIN_IDENT=false
...

API

GET /<id>
Get raw pastes

GET /p/<id>
Get highlighted pastes

GET /p/<id>.<ext>

Get syntax highlighted pastes.
E.g. https://basedbin.fly.dev/p/foobaz.cpp should return a C++ syntax highlighted paste

POST /
Post binary data

Design Decisions

This pastebin:

  • does not use a database. It lacks non-essential features like password-protection / automatic deletion as a result of which, it can do completely fine with flat filesystems. As an upside (opinionated), it makes deploying it easier.
  • uses server sided highlighting, which ensures that everything stays light and snappy at the client side.
  • uses very minimal frontend because a pastebin does not need it. It focuses (or atleast tries to) on getting things done in minimum amount of clicks.

Hacking

  • If you want to ensure your pushed refs will pass CI, add the prepush script to your Git hooks:

    $ cp -a tools/prepush .git/hooks/pre-push
    

    Alternately, just run ./tools/prepush yourself before pushing.

  • The Cargo configuration for this project is set for statically compiled builds. You can check out the config file to know more.

  • Read the buildci to know how the project is statically compiled for two architectures.

Articles
to learn more about the open-source concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Open-Source.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory