diff options
Diffstat (limited to 'content/posts/personal-pastebin.md')
| -rw-r--r-- | content/posts/personal-pastebin.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/content/posts/personal-pastebin.md b/content/posts/personal-pastebin.md new file mode 100644 index 0000000..0b978df --- /dev/null +++ b/content/posts/personal-pastebin.md @@ -0,0 +1,19 @@ +title: Personal Filesharing +date: 2025-02-17 00:00 +tags: site +summary: browsers do display all files after all +--- + +I previously used pastebin/filesharing sites to send code and images over IRC. However, I no longer do; after piecing together my own. + +The code to run the pastebin is small; it would be even smaller if I were more practiced in shell scripting: + +One script on my laptop accepts a file name and an optional time specifier in hours. It generates a new file name with a few random characters piped out of `/dev/urandom`, concatenates it with a dash - character, and a unix timestamp representing `CURR_DATE + USER_SPECIFIED_HOURS`. It then uses `scp` to copy the given file to a public-facing directory on the remote server with the generated name (the directory listing itself cannot be viewed in a browser, though, since the pasted files are meant to be relatively hidden). + +The second script on the remote server simply scans the directory every hour for files that are expired (based on the file name) and removes them. + +Of course, hosting your own pastebin is a relatively common idea if you have a webserver and the need, (I even found some tools which set up an entire netcat server if you need a full web service). However, I myself had not yet seen anyone use filenames to get almost all of the functionality of file-hosting sites like 0x0.st. I reused the idea from Protesilaos Stavrou's Emacs 'denote' package, which also showcases the power and simplicity of embedding metadata in file names; since it remains very accessible to filtering with standard CLI tools. + +I like being able to upload my files and share them from a space I still control. I only remembered to finish writing about this idea since it already had appreciated benefits in unexpected places; allowing me to share my University work through a link to my own site, rather than the suggested use of services such as google drive. + +Sometimes it's easy to forget that browsers can play raw video or display pdfs when directed to a video file. |
