SSH-powered pastebin alternative with a human-friendly TUI and web UI
snips.sh is a free, anonymous, open source, snippet service.
After @clneagu showed me this project on GitHub, I deployed it using Docker to give it a try. My initial impression is that the service is incredibly user-friendly. For anyone who spends a lot of time in the terminal and frequently needs to save notes or share them, this tool can significantly boost productivity by eliminating the need to switch between different apps.
Features:
⚡️ Zero-install: use from any machine with SSH client installed
🌐 Web UI: syntax-highlighted code with short links and Markdown rendering
🖥️ TUI: never leave your terminal for snippet management/viewing
🔑 No passwords: all you need is an SSH key
👤 Anonymous: no sign ups, no logins, no email required
🕗 URLs with TTL: time-limited access for sensitive sharing
🐳 Self-hostable: containerized and light on resources
🧠 ML language detection: intelligently identify source code
Upload from any machine, no install necessary.
Download files and pipe into your favorite $PAGER.
Something secret to share? Create a temporary, time-bound URL for restricted access.
1echo 'my secred message' | ssh go.vlaicu.io -- -private
1ssh f:[email protected] -- sign -ttl 5m
Self Hosting:
I use Cloudify.ro for all the projects I deploy or test. I appreciate its minimalist and intuitive interface for managing virtual machines, along with the ease of quickly adding extra IP addresses and taking snapshots.
1git clone https://github.com/robherley/snips.sh.git
1docker build -t snips.sh .
1docker run -p 22:2222 -p 8080:8080 -v $PWD/data:/data ghcr.io/robherley/snips.sh
1FROM --platform=${BUILDPLATFORM} golang:1.23 AS build
2
3ARG TARGETARCH BUILDPLATFORM
4
5WORKDIR /build
6
7COPY go.mod ./
8COPY go.sum ./
9RUN go mod download
10RUN go mod verify
11
12COPY . .
13
14RUN dpkg --add-architecture arm64 && \
15 apt-get update && \
16 apt-get install -y \
17 gcc-aarch64-linux-gnu \
18 libsqlite3-dev:arm64 && \
19 mkdir /tmp/extra-lib
20
21RUN if [ "${TARGETARCH}" = "amd64" ]; then \
22 script/install-libtensorflow; \
23 cp /usr/local/lib/libtensorflow.so.2 /tmp/extra-lib/; \
24 cp /usr/local/lib/libtensorflow_framework.so.2 /tmp/extra-lib/; \
25 go build -a -o 'snips.sh'; \
26else \
27 CC=aarch64-linux-gnu-gcc GOARCH=${TARGETARCH} CGO_ENABLED=1 go build -ldflags "-linkmode external -extldflags -static" -a -o 'snips.sh'; \
28fi
29
30FROM --platform=${BUILDPLATFORM} ubuntu:22.04
31
32COPY --from=build /tmp/extra-lib/* /usr/local/lib/
33COPY --from=build /build/snips.sh /usr/bin/snips.sh
34
35RUN ldconfig
36
37ENV SNIPS_HTTP_INTERNAL=http://0.0.0.0:8080
38ENV SNIPS_SSH_INTERNAL=ssh://0.0.0.0:2222
39ENV SNIPS_HTTP_EXTERNAL=https://snips.vlaicu.io
40ENV SNIPS_SSH_EXTERNAL=ssh://go.vlaicu.io:22
41
42EXPOSE 8080 22
43
44ENTRYPOINT [ "/usr/bin/snips.sh" ]
The reason why I have two subdomains is that Cloudflare does not proxy route port 22, so in order to have a SSL certificate on the web UI, I used a different subdomain from the one used for ssh and TUI *Terminal User Interface. Each of the two domains go.vlaicu.io and snips.vlaicu.io point to different IP addresses in Cloudflare, the web UI is proxied and the TUI is DNS only.
Backups:
Since SQLite is a single file on disk, the danger of corrupting/losing a database is quite high. Luckily, it’s extremely simple to set up LiteStream . Wherever your SQLite file is running, all you need is to set up a LiteStream on your host and point it to an S3-compatible object storage. It takes minutes to set up , and then you’re good to go 👍 Here’s an example of a docker-compose.yml:
1version: "3"
2services:
3 litestream:
4 command: replicate
5 image: 'litestream/litestream'
6 restart: unless-stopped
7 volumes:
8 - /home/snips/data:/data
9 - ./litestream.yml:/etc/litestream.yml
And the litestream.yml configuration:
1access-key-id: <secret>
2secret-access-key: <secret>
3
4dbs:
5 - path: /data/snips.db
6 replicas:
7 - url: s3://<url>/backups
If you have any questions about self-hosting the service, feel free to reach out. More on how to setup database replication using Litestream and Amazon S3 in this article ↴ https://x.com/flaviuvlaicu/article/1839345407828402468