Pastebin

Untitled

text 4 views Created: October 2, 2026 at 14:02:52 EDT
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
#!/usr/bin/env bash

FILE_PATH="${1:-}"

# If no file path provided, use fzf to select one
if [[ -z "$FILE_PATH" ]]; then
    FILE_PATH=$(
        find . -maxdepth 1 -type f -printf '%f\n' |
        fzf \
            --prompt="   Select file to upload: " \
            --border \
            --reverse \
            --header="Use / to select, <Enter> to confirm" \
            --pointer="➤" \
            --color="bg+:#1e1e2e,bg:#181825,spinner:#f5c2e7,hl:#f38ba8,fg:#cdd6f4,header:#89b4fa,info:#f9e2af,pointer:#a6e3a1,marker:#f5c2e7,fg+:#cdd6f4,prompt:#89b4fa,hl+:#f38a8a" \
            --preview='bat --style=numbers --color=always {}'
    )

    if [[ -z "$FILE_PATH" ]]; then
        echo -e "\033[33mNo file selected.\033[0m"
        exit 1
    fi
fi

# Validate file
if [[ ! -f "$FILE_PATH" ]]; then
    echo -e "\033[31mFile path does not exist: $FILE_PATH\033[0m"
    exit 1
fi

# Check required commands
for cmd in curl jq; do
    if ! command -v "$cmd" &>/dev/null; then
        echo -e "\033[31mRequired command not found: $cmd\033[0m"
        exit 1
    fi
done

# Upload
RESPONSE=$(curl -fsS \
    -X POST \
    -H "Content-Type: text/plain" \
    --data-binary @"$FILE_PATH" \
    "https://pste.us/documents") || {
        echo -e "\033[31mFailed to upload the document.\033[0m"
        exit 1
    }

# Extract Hastebin key
HASTE_KEY=$(printf '%s' "$RESPONSE" | jq -r '.key')

if [[ -z "$HASTE_KEY" || "$HASTE_KEY" == "null" ]]; then
    echo -e "\033[31mFailed to get Hastebin key.\033[0m"
    exit 1
fi

URL="https://pste.us/$HASTE_KEY"

# Copy URL to clipboard
COPIED=false

if command -v wl-copy &>/dev/null; then
    printf '%s' "$URL" | wl-copy
    COPIED=true
elif command -v xclip &>/dev/null; then
    printf '%s' "$URL" | xclip -selection clipboard
    COPIED=true
elif command -v xsel &>/dev/null; then
    printf '%s' "$URL" | xsel --clipboard --input
    COPIED=true
elif command -v pbcopy &>/dev/null; then
    printf '%s' "$URL" | pbcopy
    COPIED=true
fi

# Output
echo
echo -e "\033[35m$(basename "$FILE_PATH")\033[0m"
echo -e "\033[36m  Hastebin URL:\033[0m \033[32m$URL\033[0m"

if [[ "$COPIED" == true ]]; then
    echo -e "\033[33m  (Copied to clipboard)\033[0m"
else
    echo -e "\033[33m  Clipboard utility not found; URL was not copied.\033[0m"
fi

# Print QR code
echo

if command -v qrencode &>/dev/null; then
    echo -e "\033[36m  QR Code:\033[0m"
    echo
    qrencode -t ANSIUTF8 "$URL"
else
    echo -e "\033[33m  qrencode is not installed.\033[0m"
    echo -e "\033[33m  Install it with:\033[0m"
    echo -e "\033[32m    sudo pacman -S qrencode\033[0m"
fi

echo

Embed this paste

Install this app

  1. Tap the Share button
  2. Scroll down and tap "Add to Home Screen"
  3. Tap "Add" in the top right