Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>With an upbeat pling my console alerted me that my script had finished running

Forget the pwn how do I do this

Also, HN used to think this was cool now there are 20 posts blaming the hacker…



I've appended `; tput bel` to the end of long-running scripts to get the same effect.

Fun fact: the `bell` control character is part of the ascii standard (and before that the baudot telegraph encoding!) and was originally there to ring a literal bell on a recipient's telegraph or teletype machine, presumably to get their attention that they had an incoming message.

To keep backwards compatibility today's terminal emulators trigger the system alert sound instead.


In Java and JavaScript it’s just:

    \u0007
It’s handy to put in your shell code that takes a few seconds, or more, to complete.


The Apple II+ still had a ‘bell’ key on the keyboard (I can’t think of a more recent computer that had that)


I always used to just have 'echo "^G"' instead (where ^G is typed as CTRL-V CTRL-G).


on macos I just add `; say done` to my command. If I didn't think of doing it before starting the command (which is most of the time), I just type it and press enter while the command is runnign, it gets buffered and executed right after the command finishes (be careful that it's not an interactive program that you're executing though, or it might take your "say done" as an interactive entry)


You can also do Ctrl-Z to pause the running process, and then `%1; say done` (or whatever) to restart the first queued job and then run the new command. Avoids the interactive issue


>Also, HN used to think this was cool now there are 20 posts blaming the hacker…

I'm not sure whether it's HN thinking this is uncool (it is cool!) or it's HN taking the unfortunate realistic position that this type of stuff only gets the reporters into trouble, after seeing it happening time and time ago. People doing cool stuff get in trouble, and it's sad to watch.



Yeah, what happened to the "Hacker" in Hacker News. (responding to people blaming the 'hacker', not the sites).

This guy just grabbed publicly available information, and by 'public' I mean put out onto the web un-protected, just put out there. If you can just basically browse to something, is it really his fault for finding it.

It's like if I have a front door on my house, and just in the front hallway I have a huge naked picture of my wife. If I leave the door open, can I get mad at pedestrians walking by, for seeing the picture. Maybe they walkup to ring the door bell just to get closer look, walking up to the door, but not going in, is allowed.


I think according to the law and related suits based on accessing publically available URLs without authorization is still technically prosecutable - I’m not a CFAA expert but I’d double check there


I think you are correct, that the law says that.

I think the law is pretty wrong.

It means I can break law by just accidentally browsing to something. Can be breaking the law just by seeing it, before knowing I'm doing something wrong.

Basically, just see something and be guilty before being able to look away.


Debian (and derivatives like Ubuntu) come with a handy shell alias called `alert`.

It is meant to be used after a command or a chain of commands to give feedback about success or failure. The alias by itself doesn't issue a ping, but can easily be amended to do so.

What worked for me is to add an invocation of `paplay`. Actually it is two different invocations, one sound for success and another one for failure.

In addition to that I also send an ASCII 0x07. I have both `tput bel` and `echo -e "\a"` in my alias, but don't remember why. Probably one of them is enough. I do this because I have my terminal emulator set to visual bell an that causes the tab to change color when the command is finished and I can immediately see it even if I am in another tab.


That being said, there might be an easier way by configuring the desktop environment to make a noise on notification, but that is route I did not want to go.


I have this in my .bashrc

  beep() {
    if [ $? -eq 0 ]
    then
      file=/usr/share/sounds/purple/receive.wav
      ret='true'
    else
      file=/usr/share/sounds/purple/alert.wav
      ret='false'
    fi

    (aplay $file 2>/dev/null >/dev/null &);
    $ret
  }
Can be called like this:

  $ command ; beep
Depending on the return value it'll give a different alert. It preserves the return value so you can still chain other dependent commands after it.

This depends on the libpurple sounds to be where they are (works in ubuntu at least)


My fish shell shows a desktop notification if some other window has the focus and the command ran longer than 10 seconds.

Fish config: https://github.com/qznc/dot/blob/master/config/fish/config.f...

Notification script: https://github.com/qznc/dot/blob/master/bin/notify_long_runn...

I stole it from some zsh solution originally.


    #!/usr/bin/env zsh

    (mpg123 /path/to/processing3.mp3 > /dev/null 2>&1)
processing3.mp3 is the "task completed" sound from star trek,

then it's just `./foobar.sh && boc` or `./foobar.sh; boc` as appropriate.


On Kubuntu, you can use paplay to play short audio files. Change the path to an audio file of your choosing.

    sudo apt install pulseaudio-utils
    ./some_script ; paplay /usr/share/sounds/freedesktop/stereo/complete.oga


I suggest using ntfy [1] for this. It's open source and self-hostable. It lets you push notifications to your phone like this:

   ./myscript.sh; curl  -d "Script done" \
  ntfy.sh/mytopic
Disclaimer: I am the maintainer of ntfy.

[1] https://ntfy.sh/ + https://github.com/binwiederhier/ntfy




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: