
Show HN: Code to wake me up after I ruined my mobile (only source of internet) - franze
Hi HN, a week ago I was watching Netflix in the bathtub and well, water damaged my mobile beyond repair while doing so.<p>Issue:<p><pre><code>    a) my mobile phone is my only alarm clock
    b) my only available source of internet
    c) early very important business appointment 
</code></pre>
This is the code I wrote at 1 a.m. in the morning (without Google&#x2F;Stackoverflow) on my Macbook Pro
<a href="https:&#x2F;&#x2F;scontent.fvie1-1.fna.fbcdn.net&#x2F;v&#x2F;t31.0-8&#x2F;25073127_10156125886542867_1663918984257759259_o.jpg?oh=638bd7bfe3dbf8172dd7dfc83679367b&amp;oe=5AB3193A" rel="nofollow">https:&#x2F;&#x2F;scontent.fvie1-1.fna.fbcdn.net&#x2F;v&#x2F;t31.0-8&#x2F;25073127_10...</a><p>Since them I&#x27;m wondering, what would be the most elegant solution that you would come up with (without looking anything up on - or downloading anything from - the internet)!<p>Note: yes, I forgot where the milliseconds in setTimeout goes, so I put them everywhere.
======
Yetanfou
When I was a student I felt like the time had come for some modern way of
being woken up. I had a Philips CD-player and a Commodore 64. On the back of
that CD-player was an RCA connector marked 'remote control'. I sent a letter
to Philips with a request for information on that protocol and some kind soul
sent me some pages of timing definitions and encodings. I made an adapter to
go between the C64 user bus and that CD-player, wrote an alarm-clock program
which could be told to 'play track X at time Y' and off I went...

------
ezekg
Your Mac literally has an app for that called Calendar.

~~~
franze
I tried it, could not bring it to alert me. And well, "Google it" was not an
option.

------
iakie
like the other guys said, 1) use a alarm clock, 2) there's a freaking calendar
app builtin.

but if you really need to "code" for whatever reason. The core logic is
trivially simple. you need to 1) wait til the moment you want to wake up 2)
generate some noise.

so just open mac terminal and type:

sleep 28800; while true; do say "wake up"; done

------
btschaegg
"Look ma, no code!"

Use a traditional alarm clock. For instance, I use one of those cheap Ikea
alarms[1]. This means that, even when your phone is working, you don't have to
have it near your bed, which lowers your incentive to quickly look at it if
you can't sleep right away. That did wonders for my sleep quality.

\---

On topic: If I had to come up with a quick hack because it's 2am and I have no
alarm clock: I still have a mechanical time switch (for electrical power)
somewhere, and I use an old analog Technics stereo. Combine that with a
turntable and you've got yourself a fine alarm clock (although with a somewhat
coarse granularity) in less than 5 minutes. That's honestly much easier for me
than looking up media APIs I have never used without an internet connection
:-)

[1]:
[https://m.ikea.com/Us/en/catalog/products/art/50187566/](https://m.ikea.com/Us/en/catalog/products/art/50187566/)

------
ZenoArrow
The most elegant solution is just to buy an alarm clock or watch. They're
cheap to buy (you may even be able to get a second hand one for free depending
on where you lived), and would cut your electricity usage compared to running
your MBP as an alarm clock.

With your phone, have you tried anything to save it after it was damaged by
water? If you want a technical challenge, I'd suggest focusing on that.
There's advice on the web on how to repair a phone after dropping it in water.

------
mikey00764
Best solution would be to always carry a plastic bag in the bath.

~~~
ZenoArrow
That's not a solution, that's a future improvement.

------
stephenr
Having a decent IDE would basically solve the "no internet" problem, as it'll
have code hints for the standard library of your language(s).

Having common sense would have prevented the event that caused the whole
problem.

~~~
ZenoArrow
> "Having common sense would have prevented the event that caused the whole
> problem."

It has nothing to do with common sense. Accidents happen. Don't try to make
out that preventable accidents never happen to you because you have "common
sense".

~~~
stephenr
I didn't say accidents never happen to me.

I said, having common sense (ie not using a sensitive piece of electronics
while literally sitting in a bathtub full of water) would have prevented the
original problem.

Accidents absolutely happen all the time. That doesn't mean we shouldn't _try_
to avoid them by applying common sense to our actions.

