Live data from Hacker News

Make an internet radio station with one line of bash

schollz.com

41–50 of 55 posts

Re: Make an internet radio station with one line of bash

#41

I think the dissenting / mocking comments here are missing the spirit of the post. Since bash can evoke any Turing complete program, feasibly anything could be done with one line of bash. The authors intent as I saw was to show what that line was. Would you have known without this article? Whether or not people are just being sarcastic, I feel we should definitely not mock but rather encourage any open and free attem…

[deleted]

Re: Make an internet radio station with one line of bash

#43
This is really cool. I have a little node.js script I wrote that generates a funky little beat I call "egypt.js"[0] and outputs the PCM data to stdout, just for weird things like this.

My local WSL1 install of ffmpeg has an issue with the LAME encoder so using a few extra pipes I was able to get this working! Confirmed with a friend they were able to listen across the planet.

    node /tmp/egypt.js | ffmpeg -f f64le -ar 176400 -i pipe: -f wav - | lame - - | curl -s -k -H "Transfer-Encoding: chunked" -X POST -T - "https://broadcast.schollz.com/egypt.mp3?stream=true&advertise=true"

Neat stuff! I love things like this.

[0] https://gist.github.com/Qix-/7c131c6eb83bef7c44ef6faaf1eab10...

Re: Make an internet radio station with one line of bash

#44
post #18
post #7

Earlier quoted context omitted.

I love that Biden's putting his password into ~/.bash_history

It's also visible in the process table (ps auxww). It can be erased by rewriting the arguments from inside the process (I think this is OS-specific, not the same as changing argv in-place), but that is a race condition. The safe way is to either read it from stdin/fd (maybe call isatty(3) to check if someone doesn't echo password | ./foo), or open a file (check if permissions are 600). You could also have a named soc…

> It can be erased by rewriting the arguments from inside the process

Please nobody rely on this behavior. :O

Re: Make an internet radio station with one line of bash

#45

If I write a complex piece of software that does something even marginally interesting, I'm going to post it to HN with a similar title. After all, I'm sure I can execute it with one line of bash, so the title is appropriate, right?

Did you read the article? It's probably the most honest version of "one line of bash" given how prolific ffmpeg is, and the fact that, beyond one line of shell commands, I was able to listen to the streamed audio in my browser.

What more do you want? It works, quite literally, as advertised.

Re: Make an internet radio station with one line of bash

#46
post #6
post #3

I mean, you could probably launch nuclear missiles with a line of bash

sudo ./launch-missiles.sh --target=[REDACTED] --missile-count=4 --username=jbiden --password=1111

I like how you redacted the target but not the password – though I’m pretty sure the real password is alphanumeric and based on a family member: http://www.bash.org/?quote=244321

Re: Make an internet radio station with one line of bash

#49

Earlier quoted context omitted.

another option is in an env variable (from an encrypted file). gpg -d ~/secrets/nuclear_launch_codes.gpg source ~/secrets/nuclear_launch_codes where the gpg key has a password and is stored on a hardware dongle that doesn't allow copying the private key off. If you really want to be fancy, there are some hardware security keys that also require a biometric to confirm. The other option is something like Hasicorp Vault…

can't you do `cat /proc/$PID/environ`?

It's chmod 400'd and owned by process owner.

Re: Make an internet radio station with one line of bash

#50
Nobody has problems with dropped TCP connections when streaming?

Tried icecast2 on several servers at distinct hosters and audio tag on various browsers and platforms, in maybe tens of minutes it always seized up. I had to add script to client page had to detect it and reconnect, the pauses were annoying, gave up.

Did not dig deeper seems as if routers drop the connection when there are no data transmitted in one direction.

Post reply on HN