Live data from Hacker News

Bashbro – Make Any Comp a Web-Based File Server

github.com

41–50 of 52 posts

Re: Bashbro – Make Any Comp a Web-Based File Server

#41
post #34

Earlier quoted context omitted.

I solved that problem some time ago with netcat, „coproc nc -l -p PORT“. Makes bash listen to nc‘s stdout and let’s it write to it‘s stdin. But nc is not bash.

Here's my nc version, works on all shells: https://gist.github.com/alganet/140c7c12d1603c244a01 nc is almost everywhere, you can count on it. Ultimately, this is a toy, but it can be handy. I originally made it to attempt using for serving config for networked debian unattended installations[1] while automating VM creation, but never went that far. [1]: https://debian-handbook.info/browse/en-US/stable/sect.automa...

You can't count on nc being installed but you can count on it being installable.

That's a problematic distinction in some situations.

Re: Bashbro – Make Any Comp a Web-Based File Server

#42

In a slightly more heavyweight category I've settled on dufs for my single binary file serving / uploading / password-protecting needs. https://github.com/sigoden/dufs

Single Rust binary: YES.

I looked at the Bashbro source and said NOPE. And I've written a lot of increasingly complex Bash. At some point you just have to realize that you're using the wrong tool for the job. Dufs even has tests!

Re: Bashbro – Make Any Comp a Web-Based File Server

#44

I re-read "Make Any Comp a Web-Based File Server" 10 times and I don't understand what it means. Specifically the word "Comp". What does this mean?

I think it's just what 12 year olds call a computer. A comp-u-ter.

12 year olds, or non-native English speakers who use some slang and never realized how that slang is local

Re: Bashbro – Make Any Comp a Web-Based File Server

#46
post #39
post #10

This is cool, but there's currently an overload of ports assigned on my system. Is there a way to manage all these port numbers? And why can't we use strings, even if just locally? And what do people use to allocate port numbers in a way that you'll never get clashes?

No way to allocate port numbers without clashes ever. What I do is having a Ports.md in my personal knowledge base with all port assignments in my personal projects and networks: port, description, project link and/or service host:port. This works very well, I don’t have tens of thousands of projects so I’m not going to exhaust port numbers. I used to try to use Unix domain sockets as much as possible for anything fr…

You can listen on port 0 and print the actual port on the stdout.

Re: Bashbro – Make Any Comp a Web-Based File Server

#47
post #22
post #10

This is cool, but there's currently an overload of ports assigned on my system. Is there a way to manage all these port numbers? And why can't we use strings, even if just locally? And what do people use to allocate port numbers in a way that you'll never get clashes?

You can listen on an anonymous port. It's similar to how the kernel allocates a port for outgoing connections. It's very useful if you want to listen ephemerally, especially in tests. The downside is that you need your server to report which port it's actually listening on, and if it restarts, it will get a different port.

Well, you need to monitor the process for going down anyway, and

    ss -lntp | grep 'pid=' | awk '{ print $4 }'
takes care of servers who don't report the port they're actually listening on.

Re: Bashbro – Make Any Comp a Web-Based File Server

#49
post #39

Earlier quoted context omitted.

No way to allocate port numbers without clashes ever. What I do is having a Ports.md in my personal knowledge base with all port assignments in my personal projects and networks: port, description, project link and/or service host:port. This works very well, I don’t have tens of thousands of projects so I’m not going to exhaust port numbers. I used to try to use Unix domain sockets as much as possible for anything fr…

You can listen on port 0 and print the actual port on the stdout.

Doesn’t work for services talking to each other or bookmarks, or reverse proxies for that matter.

Re: Bashbro – Make Any Comp a Web-Based File Server

#50

In a slightly more heavyweight category I've settled on dufs for my single binary file serving / uploading / password-protecting needs. https://github.com/sigoden/dufs

Webd: A 90kB Alternative you might want to try https://github.com/webd90kb/webd
Post reply on HN