16 comments

[ 3.0 ms ] story [ 44.3 ms ] thread
Hi everyone, I was curious to see how many times my GitHub profile page was visited so I made a counter for it. Since I made it, I've decided to share. Thanks.
The 1990s called and wants it’s hit counter back! Seriously though: Cool project :-).
Thank you. I remember this being super popular in my blogging times (this and third party comments system) but when I needed one I didn't find any. So before bed yesterday I wrote one. Glad you liked it.
Does this count as serverless? I don't see the usual request response event loop.
Request response event loop?

It is a dynamic image generator written in PHP that increments the counter it renders. It runs on a PHP web server. Its not serverless.

I think it was an attempt for a joke as today even the easiest jobs like increment a number are over-engineered with serverless architecture
.php files were the original "lambda"s.

For true serverless, turn off your PC, laptop and phone and go for a walk in nature.

You have some weird threading/locking bugs. Its possible to reset the counter by spamming refresh a few times.
Someone did open a issue about this and I think I fixed it.
Shouldn't it have an IP/local cookie based filter after one time?

An alternative with the same flaw, https://komarev.com/ghpvc/?username={github_username}&label=...

Na, I made this one to be simple. That's why I ditched database and everything else. The thread issue I think you can cross data with the server logs to see how many requests were made vs the number on the counter.
Well, someone did spam my counter:

https://imgur.com/7h5uFoY

So, if I remove the hits from the spammer, the counter number is at 15585, so I'll just paste it in the counter.txt
An counter not counting unique visitors or has an rate-limit is the easiest target for anyone knowing how to run an `wrk` command.

There is a reason, why such things aren't this simple.

this is not a visitor tracker, just a hit counter (page view). I did start writing a parser for the server logs to have a more robust statistics for my website, but there are plenty of good options out there, awstats for instance. this is not it.

the person spamming the counter war trying to corrupt the counter.txt file and reset the counter.