Hacker News new | ask | show | jobs
by Cicero22 2079 days ago
Big fan of MikroTik myself, but the scripting language can be pretty finicky and has a somewhat steep learning curve. I won't claim I've mastered it, but after a couple of months of working with it, I still feel handicapped by the syntax, quirks, and general lack of usability.

For example, this is how I'm finding the subnet mask from a string like "192.168.1.0/24" in a script I recently wrote (I think I got this from a forum post, but I can't find it anymore.)

:local mask do={ :return (255.255.255.255 << (32 - [:pick $1 ([:find $1 "/"] + 1) [:len $inet]]))}