
When devops makes a clock - smaslennikov
http://smaslennikov.com/whattimeisitrightmeow/
======
TeMPOraL
TL;DR of the implementation: every minute, the script updates the HTML page
with sed, and then commits it into git and pushes it into Github...

What can one say. At least they didn't use Kubernetes for that.

~~~
tehlike
or store the value in a mongo instance.

~~~
medokin
*cluster

~~~
chronid
Replication is for pussies, and we have no money anyway for infrastructure.
YOLO.

------
Tepix
Well, it shows the wrong time (by 9 hours). Must be American... Non
surprisingly, someone already opened an issue on github.

~~~
pasta
The fix is easy: add the letters 'UTC' after the time.

~~~
vlasev
I propose opening a new repo for each time zone.

~~~
Cthulhu_
Spin up a Docker container for every timezone, and make sure to destroy the
old ones every time the timezone is updated.

Also have at least three instances running, for redundancy and zero-downtime
updating.

------
retor
This is genius!

SSCG: Static site clock generator.

* Fast (no server side scripts running on get requests) * Safe (no server side scripts running on get requests) * Version controlled (every version of the time is stored in version control in case of time warp)

~~~
smaslennikov
Lost it at

> Version controlled (every version of the time is stored in version control
> in case of time warp)

------
gargravarr
Looks pretty benign on first glance. It's only when you look on Github that
the true horror reveals itself.

I'm laughing a lot more than I should at this.

~~~
smaslennikov
yayyyy the deception is real

------
ejolto
I looked at the github repo, and the readme has this sentence

> I woke up one morning after seeing the traeish of Bojack Horseman and
> thought

What does traeish mean? I tried to google but that didn't help much.

~~~
smaslennikov
Traeish is how us cool people at grindr pronounce the word 'trash'. Here's a
vague example:
[https://www.youtube.com/watch?v=x9d5csMFAfE](https://www.youtube.com/watch?v=x9d5csMFAfE)

------
jpatokal
See also, when Wikipedia editors make a clock:

[http://pageoftext.com/wikiclock](http://pageoftext.com/wikiclock)

And they're up to >13,000 revisions already...

[http://pageoftext.com/PH_page_revisions&nm_page=wikiclock](http://pageoftext.com/PH_page_revisions&nm_page=wikiclock)

------
bostand
Why didn't he use left-pad.io?

An opportunity lost if you ask me.

~~~
skytreader
JS isn't a very dev-ops tool if you ask me.

~~~
Cthulhu_
Could use JS to generate and orchestrate dockerfiles I guess.

------
Gys
Automatically going for 'most commits ever' as well, I guess:
[https://github.com/smaslennikov/whattimeisitrightmeow/commit...](https://github.com/smaslennikov/whattimeisitrightmeow/commits/master)

~~~
edvinasbartkus
How much time will it take to reach the limit of GitHub repository size
(~1GB)?

~~~
rcfox
Eventually, they'll have a version of the file for each minute in the day.
After that, the hash should ensure that no additional space is used to store
the content. (I think, I don't know much about git internals.)

After that, if you assume 128 bytes per commit (timestamp, and maybe a hash or
two saved?) then probably around 14 years.

~~~
mbrock
Every commit will need a new tree object, containing the names, hashes, and
chmod of each file/folder in the root (LICENSE, README.md, _config.yml,
index.html, and bin).

I modified the script to commit as fast as possible (cycling the minutes
between 1 and 60), and after 600 commits, doing "git gc --aggressive" before
and after, the .git directory grows by around 460 bytes per commit.

~~~
smaslennikov
nice!

------
noonespecial
It's like... watching someone dig a swimming pool with a spoon.

Magnificent.

~~~
johnlbevan2
Reminds me of "Here's two ducks, they're digging a hole".

[https://www.youtube.com/watch?v=wfvEgWINUFc](https://www.youtube.com/watch?v=wfvEgWINUFc)

~~~
smaslennikov
ohhhhhh shit i love it!

------
nathankunicki
Well, if individual people raised a PR to update the time every minute, they
would have essentially made a distributed time mechanism.

Need some kind of quorum/consensus algorithm in order to handle duplicate PR's
though.

------
mmcallister
Oh god this physically pains me. I love it.

~~~
smaslennikov
I can hear the teeth grinding from here

------
pjc50
Reminds me of
[http://www.hexmaster.com/goonscripts/what_time_is_it.html](http://www.hexmaster.com/goonscripts/what_time_is_it.html)

~~~
smaslennikov
Entirely relephant!

------
MetalMatze
I just want to leave my version of this here:
[https://time.kitchen](https://time.kitchen)

If you write Go every now and then you might get it.

~~~
smaslennikov
Awwww yusssssss high five! Where's the sauce though?

While everyone around me is a gofan, I haven't touched it yet.

------
david90
I remember that time when using text files as my database when I did web
programming 15+ years ago.

btw can I send a PR to your repo?

~~~
Gys
I use json files on s3 to store data for some projects. Far cheaper then
having a database.

------
hussfelt
This is fantastic. I could not help myself, fixed issue #3. Pain is real!

~~~
smaslennikov
Thank you! Bring on the pain

