A (self hosted) pastebin for easily sharing text right from the terminal

Related tags

Applications termpad
Overview

termpad

termpad allows you to easily host a pastebin server for saving and viewing text right from the terminal, or the browser.

Client Usage

Assuming termpad is running in localhost:8000 you can do this to save text using cURL:

$ curl -d "Hello world" localhost:8000
http://localhost/DullMagnificentLock
$ # Or
$ curl --data-binary @path/to/file localhost:8000
http://localhost/BrightAliveMotorcycle

And this to retrieve saved text:

$ curl localhost:8000/raw/TenderCheerfulYacht
$ # You might optionally want to pipe the output to a pager like less
$ curl localhost:8000/raw/TenderCheerfulYacht | less

Or this for HTTPie:

$ echo "Hello World" | http POST localhost:8000
http://localhost/DullMagnificentLock
$ # Or for files:
$ http POST localhost:8000 < path/to/file
http://localhost/BrightAliveMotorcycle

And to get text it's the same as cURL:

$ http localhost:8000/raw/TenderCheerfulYacht
# Or with a pager
$ http localhost:8000/raw/TenderCheerfulYacht | less

Note the /raw/ in the url, without it you will get html output

Server Usage

Note that environment variables are checked before assigning the default value.

Domain (-d or --domain, env = DOMAIN)

Used to construct the url returned to the user. http is added as a prefix (Default: localhost)

$ termpad -d example.com

This will return urls like: http://example.com/BrightAliveMotorcycle

Port (-p or --port)

Set the port on which the app runs (Default: 8000)

$ termpad -p 8043

Output (-o or --output)

Relative or absolute path to the directory where you want to store user-posted pastes (Default: ~/.local/share/termpad/)

$ termpad -o /home/www/pastes/

https (--https, env = HTTPS)

If set, urls will start with https instead of http

$ termpad --https

Delete files (--delete-after, env = DELETE_AFTER)

How many days to keep files for. If set to 0 it will keep them forever (Default: 120)

$ termpad --delete-after 60

Install

From source:

$ git clone https://github.com/SpyrosRoum/termpad.git
$ cd termpad
$ cargo build --release
$ ./target/release/termpad

From cargo:

$ cargo install termpad

With docker-compose:

Either wget https://raw.githubusercontent.com/SpyrosRoum/termpad/master/docker-compose.yml or copy the following into docker-compose.yml

version: "3.4"

services:
  app:
    image: spyrosr/termpad
    ports:
      - 8000:8000
    environment:
      - DOMAIN_NAME=example.com
      - HTTPS=true
    volumes:
      - data:$HOME/.local/share/termpad/
    restart: always

volumes:
  data:
    name: termpad

and then docker-compose up -d

You might also like...
🎧 a self-hosted Spotify → Discord music bot
🎧 a self-hosted Spotify → Discord music bot

Aoede is a Discord music bot that directly streams from Spotify to Discord. The only interface is Spotify itself. Note: a Spotify Premium account is c

Octopus Linguistics for self-hosted runners

octoling Octopus Linguistics for self-hosted runners. Early PoC Allows to create self-hosted ephemeral runners on various providers. (currently only s

A self-hosted Fuzzing-As-A-Service platform

OneFuzz A self-hosted Fuzzing-As-A-Service platform Project OneFuzz enables continuous developer-driven fuzzing to proactively harden software prior t

Jotsy is a self-hosted, free and open-source note taking app with a goal of simplicity in mind
Jotsy is a self-hosted, free and open-source note taking app with a goal of simplicity in mind

Jotsy: Just your notes Jotsy is a self-hosted, free and open-source note taking app with a goal of simplicity in mind. It is powered by Skytable. Read

Self-Hosted alternative to GitHub Gists

Gists Self-Hosted GitHub Gists Features Upload code snippets Syntax Highlighting Comments Versioning through Git Fork gists Gist privacy: public, unli

Self-Hosted alternative to GitHub Gists

GitPad Self-Hosted GitHub Gists Features Upload code snippets(✓ REST API) Syntax Highlighting Comments Versioning through Git Fork gists Gist privacy:

Manage self-hosted Supabase instances with an easy to use API & Web Portal (soon)

SupaManager A project by Harry Bairstow; Manage self-hosted Supabase instances with an easy to use API & Web Portal (soon) ⚠️ Note: The project is in

Self-hosted, fast, and efficient replacement for ngrok, built with Rust

reverse-proxy reverse-proxy is a self-hosted, fast, and efficient replacement for ngrok, built with Rust. The project leverages the power of Tokio and

A self-hosted backend for Deno KV
A self-hosted backend for Deno KV

denokv A self-hosted backend for Deno KV, the JavaScript first key-value database: Seamlessly integrated JavaScript APIs ACID transactions Multiple co

Temporary elevated access management as a self-hosted service
Temporary elevated access management as a self-hosted service

💻🔐☁️ S A T O U N K I Temporary elevated access management as a self-hosted service Overview Satounki is a self-hosted service which brings visibilit

Self-Hosted Remote Dev Environment
Self-Hosted Remote Dev Environment

Lapdev Self-hosted remote development enviroment management with ease Lapdev is a self hosted application that spins up remote development environment

WriteForAll is a text file style checker, that compares text documents with editorial tips to make text better.

WriteForAll: tips to make text better WriteForAll is a text file style checker, that compares text documents with editorial tips to make text better.

Send emails right from the terminal using Rust!

Send emails right from the terminal using Rust!

A CLI tool connected to GPT-3 to help find the right terminal command

Command Recall A CLI tool connected to GPT-3 to help find the right terminal command Install to install the cli: cargo install --git https://github.co

Browse and listen to thousands of radio stations across the globe right from your terminal 🌎 📻 🎵✨
Browse and listen to thousands of radio stations across the globe right from your terminal 🌎 📻 🎵✨

TuneIn CLI A command line interface for TuneIn Radio. You can search for stations, play them, and see what's currently playing. 🚚 Installation Compil

🍥 Access the rust playground right in your terminal
🍥 Access the rust playground right in your terminal

rustycli — 🦀 Access the rust playground right in your terminal 🍥 rustycli is a tool, allowing you to access the rust playground right in the termina

Get your github contributions right in your terminal, blazingly fast!
Get your github contributions right in your terminal, blazingly fast!

GitColorScripts Get your github contributions right in your terminal! Installation Install via yay yay -S gitcolorscripts Install manually Download t

pastebin written in pure rust. A rewrite of ptpb/pb.

rspb rust fork of ptpb/pb TL;DR Create a new paste from the output of cmd: cmd | curl -F c=@- https://pb.mgt.moe/ Usage Creating pastes echo hi | c

Rustypaste is a minimal file upload/pastebin service.
Rustypaste is a minimal file upload/pastebin service.

Rustypaste is a minimal file upload/pastebin service.

Comments
  • [Feature] Add way to comprese the text

    [Feature] Add way to comprese the text

    Text is already very light but it can get a lot lighter when compressed. It might be worth adding the ability to keep compressed text if the performance hit is not big

    I am thinking a feature flag (similar to web) would be nice so we don't force people to build dependencies and features they don't use.

    In case we do this I think --output should point to the compressed file in which text will be appended

    enhancement 
    opened by SpyrosRoum 2
  • [Feature] Add support for getting port numbers as arguments instead of hard coding them

    [Feature] Add support for getting port numbers as arguments instead of hard coding them

    I'm not sure if this should happen. Pro: - More customizable and power to the user Cons: - You have to know the port for each self hosted server if you want to use it (Is this really an issue though?) - If a client is written one day, you will have to set the ports to be used somehow (arguments/config file/env variables)

    enhancement 
    opened by SpyrosRoum 2
  • [Feature] Delete old files

    [Feature] Delete old files

    Currently I don't keep when they were created anywhere, this is will probably have to change or we can check the metadata, not sure what way I prefer. I'd like to keep them around for a while, a year at least

    enhancement 
    opened by SpyrosRoum 0
  • Version 2.0

    Version 2.0

    Whole project was re-written in axum; the api remains the same, the executable doesn't take command line arguments anymore but it uses env variables entirely

    ToDo

    • [ ] Update README
    • [ ] Introduce tests This will need a change in the structure of the project to accommodate easy testing
    • [ ] Swap log for tracing
      • [ ] Improve the number and the quality of the logs
      • [ ] Use TraceLayer from `tower-http
    • [X] Settle on a way to configure the app. With #9 I made all of configuration to happen with env variables exclusively but maybe a file would be good? I don't think I will bring back the old cli configuration Update: env variables are enough.
    opened by SpyrosRoum 0
Owner
Spyros Roum
Just a guy who likes low level things and loves Rust. I also like sci-fi books and Karate.
Spyros Roum
Dragit - Application for intuitive file sharing between devices.

Dragit helps you share files between computers in the same network.

Piotr Gołąb 124 Dec 23, 2022
A cross-platform, OpenGL terminal emulator.

Alacritty - A fast, cross-platform, OpenGL terminal emulator About Alacritty is a modern terminal emulator that comes with sensible defaults, but allo

Alacritty 43.7k Dec 28, 2022
A new kind of terminal

notty - not a typewriter notty is a virtual terminal like xterm, gnome-vte, sh, or rxvt. Unlike these programs, notty is not intended to emulate a DEC

Saoirse Shipwreckt 2.2k Jan 6, 2023
A terminal IRC client

tiny - Yet another terminal IRC client tiny is an IRC client written in Rust. Features Clean UI: consecutive join/part/quit messages are shown in a si

Ömer Sinan Ağacan 812 Dec 20, 2022
A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust

Wez's Terminal A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust User facing docs and guide a

Wez Furlong 6.7k Jan 2, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Run the right version of python, in the right environment, for your project

rpy Do you deal with lots of virtual python environments? rpy is for you! Before rpy: ~/dev/prj$ env PYTHONPATH=src/py path/to/my/interpreter src/py/m

Aquatic Capital Management 2 Dec 8, 2022
A simple and efficient terminal UI implementation with ratatui.rs for getting quick insights from csv files right on the terminal

CSV-GREP csv-grep is an intuitive TUI application writting with ratatui.rs for reading, viewing and quickly analysing csv files right on the terminal.

Anthony Ezeabasili 16 Mar 10, 2024
Rustpad is an efficient and minimal collaborative code editor, self-hosted, no database required

Rustpad is an efficient and minimal open-source collaborative text editor based on the operational transformation algorithm

Eric Zhang 2.5k Dec 31, 2022
A self-hosted Fuzzing-As-A-Service platform

OneFuzz A self-hosted Fuzzing-As-A-Service platform Project OneFuzz enables continuous developer-driven fuzzing to proactively harden software prior t

Microsoft 2.6k Dec 30, 2022