Show HN: I wrote an HN bot to suggest HTTPS url when people post HTTP URLs It's inspired by this comment I made: https://ift.tt/3dxKQhp. I actually saw several comments with HTTP URL posted, and that was the only one I bothered to comment on. So I thought that this is something better suited for bots than human. I hacked this together over yesterday and today: https://ift.tt/39E50Vx. Basically it uses the Firebase API (https://ift.tt/1s98Sn3) to find comments with HTTP URLs in them, try the HTTPS version, compare the contents, post back a comment if the contents are more than 95% similar. The "95% similar" part was actually the first part I wrote in the code. At first I tried a few existing go packages implementing diff/lcs, but most of them was quite slow and does a lot of allocations when I'm comparing two randomly generated 10KiB blobs, so I wrote my own (https://ift.tt/3dBlOh5), which is optimized for space (it does almost no allocations), and it's also faster because allocations are slow. (I know this is an unfair comparison that most of the existing implementations need to give you an output that can be used to reconstruct the two blobs back, so at least some of their allocations are required and unavoidable) I also wrote a bug that it would find the same HTTP url in every run and post the same comment over and over again. My apologize to dang or whoever dealt with it (or maybe the system is good enough that it blocked those repetitive comments automatically). In the end it successfully made 6 comments across ~4 hours (not including the repetitive ones). All of those comments are flagged (likely due to hn policy), https://ift.tt/3cRlkEJ is the only one that's still visible to other users at the time of writing, if you are curious. I just killed it completely from the request of dang. Although it only lived for a few hours, it's still a fun exercise. Maybe I'll convert it into a reddit bot next? Who knows. April 5, 2021 at 05:22AM
Show HN: I wrote an HN bot to suggest HTTPS url when people post HTTP URLs https://ift.tt/3uq7XB1
Related Articles
Show HN: Quotes Game https://ift.tt/lIaUc68Show HN: Quotes Game https://ift.tt/xM1oWU0 January 16, 2025 at 09:42P… Read More
Show HN: Nail Designer AI – AI-Powered Nail Art Creation https://ift.tt/Vjhe9NJShow HN: Nail Designer AI – AI-Powered Nail Art Creation https://ift.t… Read More
Show HN: A Common Lisp implementation in development https://ift.tt/vwlfCIsShow HN: A Common Lisp implementation in development I've been working… Read More
Show HN: The Phoenix LiveView and OTP Crash Course (Free Tutorial) https://ift.tt/bOC2uSVShow HN: The Phoenix LiveView and OTP Crash Course (Free Tutorial) htt… Read More
Show HN: Discorch – Offline tool to browse and delete your Discord messages https://ift.tt/iJpcYEaShow HN: Discorch – Offline tool to browse and delete your Discord mes… Read More
Show HN: I Put Snake in my Resume [pdf] https://ift.tt/QUkpTPGShow HN: I Put Snake in my Resume [pdf] I'm sure you've seen the post … Read More
Show HN: Compile C to Not Gates https://ift.tt/SEmhtOPShow HN: Compile C to Not Gates Hi! I've been working on the flipjump … Read More
Show HN: Hackslash.org Slashdot-esque AI summaries/tags of HN posts https://ift.tt/paDMumqShow HN: Hackslash.org Slashdot-esque AI summaries/tags of HN posts I'… Read More
0 Comments: