Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ntfy: A utility for sending notifications (github.com/dschep)
226 points by snehesht on Aug 27, 2016 | hide | past | favorite | 45 comments


This already exists. It's called noti. It's cross-platform, supports most of the same backends, and can send Slack notifications (which ntfy can't). It also has an awesome API. You can put `noti` at the start of a command or `;noti` at the end, which is what I always do. I never remember to set the notification until after I've typed the command. If you forget to set the notification and the command is already running, you can call `noti -pwatch <pid>` and set notifications after the fact. It's very well thought out.

https://github.com/variadico/noti


Bash tip: you can schedule an arbitrary command to run when the current command completes by suspending it with CTRL-Z, and then typing "fg; <CMD>".

(This doesn't seem to be documented specifically anywhwere, but it's implicit in the way bash's job control works.)


Which is identical to write "cmd; nextCommand"

E.g. sleep 2; echo it works


I think the point of the tip was to show how it is done when process is already running and you forgot to add a command to be run immediately after


Apart the fact that you sound like an advertisement for another software it takes just a few seconds to see that noti doesn't work on windows or with telegram for example. Not supporting a major OS is a big deal.


I'm adding very basic Windows 10 (because notifications are ~50 lines there, many many more on older platforms) support.

Writing my first Go code was easier than packaging ntfy for Windows, FWIW.


Telegram is dangerous snake oil, and its use should be discouraged.


Why? Lately my paranoia calmed down somehow, and I'm even considering to install it (I need to have some messenger, after all, and it doesn't make me feel as naked, as skype or whatsapp would). Care to make me reconsider?


Only if you are using that major platform.


I don't use Windows, but Linux.


You might also mention that it's Go instead of Python, which makes it a lot more friendly to users. I've stopped using anything written in Python since previous trips down that path have all seemed to result in pain and Google searches related to the runtime environment.


For this kind of tool, where performances are definitely not important, I'll pick Python, Ruby and Node all the time. I assume that pip, bundle and npm already did their job and installed everything I need. Then I'm able to look at the code, change a few lines and run it again with only a text editor. The extra steps to download the source code and go through a compiler are not worth the trouble.


On the other hand, a language & tooling that by default compiles to a static executable, such as Go, means no dependency trouble or installation steps at all, now or in the future. Just copy 1 file to all your machines and you have that command available.

If the software is open source, you can still change anything with your text editor and recompile the executable, usually with a single command (go build, IIRC.) Additionally, you can keep all the executables for all your versions and modifications.

Try to do that with Python, when the change you need is somewhere deep inside a library. At best you'll spend hours setting up multiple Virtualenvs; at worst it will just be impossible. Case in point, you can't use a Virtualenv for ntfy on OS X of you want desktop notifications (for whatever reason.)


Today I dumped a not-insignificant amount of time into trying to package ntfy into a single exe on Windows (using PyInstaller. It sort-of works, but was way way more painful than it needed to be. Python packaging still sucks in 2016. Go is way ahead of Python in that regard, but comes with its own quirks (GitHub by default, always uses the HEAD version of libraries, GOPATH)


I'm not familiar with PyInstaller but I wouldn't do anything similar with scripting languages. They are meant to be distributed as scripts so I'm not surprised it took you all that time. Why didn't you use pip to install on (I suppose) those other Windows machines?

There are similar problems with Ruby when people want to distribute executables. I remember I googled a solution that made a friend of mine happy (he had to deploy on multiple Windows machines, I don't remember what I suggested him to do) but still it's the wrong way to go. If creating a single executable is a hard requirement then yes, they are the wrong languages to solve your problem.


I didn't use pip because the normal way to distribute applications on Windows is to use an exe, possibly with an installer.

Packaging Python on Windows has always been tricky.

https://github.com/larsch/ocra is the Ruby equivalent.


No way! A static binary is infinitely easier to deploy, patch, and maintain. Especially across systems.

Python, Ruby, and Node are becoming less popular for a reason.


This the first I've heard of noti, looks cool tho.

Ntfy does many of these things too, for example A coworker had suggested the PID option so it has that too :)

I mostly use the shell-integration that automatically sends notifications for commands taking longer than 10 seconds (if the terminal isn't focused).


I have to agree that Noti is way better.


I've always just used mail to send a text for notification:

./long_running_script.sh && mail -s "Script Done!" number@tmomail.net


Neat, I've been working on a similar tool, but I've been trying to make it not require a 3rd party service for cross machine notifications.

I've been testing things out like udp multicast and zyre.

mobile notifications are tricky, looks like one can use https://developers.google.com/web/updates/2015/03/push-notif..., but that still technically piggybacks over google cloud messaging.


It adds another dependency, but you could always try Avahi/Zeroconf. Good for service discovery on a local network.


The problem I have with that is I then have to run yet another app on my phone. I want to run less apps, not more (especially on Android, where running an app seems to mean it can use any amount of battery it wants).

When my subscription to PushBullet runs out I'll be experimenting with PushOver. It's Growl all over again, but not quite as good.

Edit: Ntfy looks like exactly what I want. I do really like the idea of notifications that stay within my LAN, or are under my direct control. Now that I have SSL on my home server, I should be able to use Chrome notifications to Android (but isn't GCM involved there somewhere anyway?)


I ran into this the other day but had trouble getting the server to run: https://f-droid.org/repository/browse/?fdfilter=notification...


Funny to see this on HN since I just released an Android App called Simplepush (https://simplepush.io) which qualifies for what Ntfy calls a backend.

Let's see if they accept a PR to list me as an additional backend :)


Yup! I'll review it when I'm not sleepy :)


On OS X I usually do 'cmd && say "files done" || say error'


How did you get your phones display on your desktop?


I'm not the author but If I have to guess, author must have recorded the phone screen ( using something similar to https://play.google.com/store/apps/details?id=com.hecorat.sc... ) and desktop screen, overlapped the phone screen video onto the desktop using video overlay feature during post production.


Could have also possibly been an emulator.


Bingo


You can use adb to screenrecord. (I have never tried it though)

https://developer.android.com/studio/command-line/shell.html

EDIT: I think this actually does not answer your question. Sorry.


You can use Vysor which mirrors android screen on desktop.

https://chrome.google.com/webstore/detail/vysor/gidgenkbbabo...


Are you sure that's his phone and not Android Studio's Android Emulator (https://developer.android.com/studio/run/emulator.html)?


That was my Nexus 5x. The computer was a VM tho.


I didn't. Recorded videos on both the phone and the computer(a VM actually), then put it together with.. I don't remember what. Some video editor available in the Ubuntu repos.


I am looking for a tool that sends me webhooks for events that happen on my phone. (Idea is to pre-process SMS message that I get and show me priority notifications via Chrome or other means).

Anyone knows of something that does this? (Android)


I think pushbullet does that.


I was hoping to see a framework for getting notifications in the shell, like in the screen / tmux status bar.


You can already do this with `write` which is in most linux distro's. Make sure `mesg` is set to y then test with `echo "hello" | write <username>`. `Wall` messages all logged in users and I wouldn't recommend that approach.


You could try a script that receives notifications and then prints them inside the status bar.

Tmux has refresh interval so you could easily setup a script that prints the notification for a while and then clears it.

set -g status-right "#[fg=colour010]#(/path/to/your/script)#[fg=colour255]"


You could use "wall", but that is not limited to a status bar and just prints in the terminal.


Seems pretty cool!


The fact that it doesn't support major OS is a bummer


How so? It runs on Mac OS, Linux and Windows.




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

Search: