Reddit is a great place to follow various news and updates – I’m using it to keep up to date with programming-related stuff, https://www.reddit.com/r/programming/
Although it could be read directly on the website (I guess), I prefer to do it via RSS aggregator (I use Feedly) – it makes it so much easier to track updates. So adding .rss to the Reddit URL, I get all I need in the aggregator (e.g. https://www.reddit.com/r/programming/.rss)
Well, more than I need, actually – it points me to the Reddit page with comments about the article, and those comments are the very last thing I want to see (if you tried to read them at least once, you’d understand; if not – just try; or trust me).
So doing extra navigation by clicking each article’s subject one more time after Reddit page loads, it finally got me – and I wrote a little proxy page that would replace Reddit comment page link with actual article link in the RSS feed XML.
It’s all here: https://github.com/hydralien/tools/tree/master/reddit-streamline
There’s a bunch of debug stuff there, and Godaddy-caused library loading nonsense, but the gist is simple – could also be tested at https://www.hydralien.net/py/direddit/r/programming/.rss
Well, at least these folks:
are no longer smashing the tripgang.com – not that they did much, but enough to let them off to whatever they fancy under those opaque helmets.
So… it’s been quite a while. Now the aforementioned TripGang hosts these:
- KML2GPX (convert Google KML mars into GPX or OSMAND-friendly GPX)
- MapMarks (search and bookmark travel pinpoints)
- WikiVert (auto-search for all points from WikiTravel-like text/attractions list)
It’s quite curious how things turn out – the initial idea for the resource was completely different (well, who knows, I might get to it some day after all) – but hey, “whatever works”, right? Hopefully these tools (however immature and weak they are) might be useful to someone (and most hopefully to myself).
Well… bon voyage, there’s not much else to say really.
Had some free time and had a need to parse out a number if similar (but not the same) blocks from a log file. There are tools for that – it could be done with a mixture of grep, sed, bash and some arcane magic – but I’m afraid to find the right toolset, learn required keys for each and experiment with their values and combination would take me longer than to just write me a tool. And it was another opportunity to write a few lines in Python, which I don’t do often enough. And I do love text processing.
So I made me a neat little tool that essentially does one simple thing – starts printing the input stream when some (start) trigger is found there, and stops when another (end) occurs. There are some additions – like, print some lines before/after the block, print couns, unique blocks only etc. – but those are glitter, mostly.
Available in a BitBucket repository.
Just for the record – custom algorithm for searching greatest prime divisor of a number, O(n) worst-case (O(sqrt(n)) taken by prime detection):
def prime(num, get_number=False):
for divisor in range(2, int(math.sqrt(num)) + 1):
if num % divisor == 0:
return num if get_number else True
def hydra_gpd(num, get_number=None):
sequence = range(2, int(math.sqrt(num)) + 1)
gpd = 1
for divisor in sequence:
divided = int(num / divisor)
if num % divisor == 0:
if prime(divisor) and divisor > gpd:
gpd = divisor
if prime(divided) and divided > gpd:
gpd = divided
recursive_gpd = hydra_gpd(divided)
if recursive_gpd > gpd:
gpd = recursive_gpd
Nothing too special, just to keep it around.