Bash one-liner for scraping direct links to top Lifehacker stories of the week
There’s probably a more efficient (and more accurate) way to do this but oh well. It works.
curl -s http://lifehacker.com/tag/highlights/rss | grep -m 4 -i "inset id=" | grep -iv CDATA | egrep -o 'https?://[^"]+'
Great for parsing and sending to readability!
Wow. Fascinating… and a little depressing. #GameOverMan
MySQL Query For Rows Within Time Range
I’m writing this down before I forget and it gets lost to the abyss. Here’s an example query for returning mysql rows between 24-48 hours ago:
SELECT * FROM YOUR_TABLE t WHERE t.datetime_column < DATE_SUB(NOW(), INTERVAL 24 HOUR) AND t.datetime_column > DATE_SUB(NOW(), INTERVAL 48 HOUR)
Thanks to OMG Ponies at stackoverflow for the tip.
Chant of Mul Daya is mighty!
I’ve been playing more Magic 2014 (on PC) lately and recently unlocked a deck called “Chant of Mul Daya”. It’s a friggin’ BEAST. Check it out:
//Creature (21) 1 Artisan of Kozilek 4 Farhaven Elf 4 Grazing Gladehart 1 It That Betrays 2 Oracle of Mul Daya 1 Pathrazer of Ulamog 3 Pelakka Wurm 1 Primeval Titan 1 Sporemound 2 Ulamog's Crusher 1 Vastwood Hydra //Enchantment (4) 4 Khalni Heart Expedition //Sorcery (7) 3 Explore 4 Rampant Growth //Tribal Enchantment (1) 1 Eldrazi Conscription //Tribal Sorcery (2) 2 All Is Dust //Land (25) 25 Forest
(There are some various unlockable cards that can further augment things but I’ll leave those out for now.)
At its heart, this deck has a ruthlessly simple strategy:
- Give land to the player as quickly as possible.
- Try to sustain player health while collecting enough land to unleash MASSIVE heavy-hitting creatures.
At first, I thought this approach might not work but to my surprise, the overall strategy fairs QUITE well. The natural “enemy” to this deck is of course aggro-heavy opponents — it’ll take at least 6+ rounds to get where you reaaaallly need to be. All things considered though, it quite good.
Shout out to my buddy Ron for telling me about this and insisting I try it out. :-)
It’s Trance Tuesday! I’m digging this track from Yuri Kane.
Default Outbound Connection Handling Logic For Sendmail
An interesting question came up the other day (of which I’m paraphrasing):
In the event that Sendmail has multiple “first-time” outbound emails to deliver at once and a single downstream smarthost is defined, how does it handle outbound connections? Does it send everything in single file?
Initially, I thought that delivery would be handled in a serial fashion to save on time spent establishing (and tearing down) connections. After testing and researching a bit more though, that’s not quite right.
While it’s true that Sendmail has some connection caching features (like
ConnectionCacheTimeout params), that’s not really involved in first-time delivery of messages.
By default, Sendmail uses a delivery mode called
background. More information is available in section 24.9.35 of the famous Sendmail bat book (web excerpt available here). This mode allows Sendmail to fork another process for delivery after accepting any message. So in short, Sendmail uses multiple threads (which is good news for folks with a lot of email to send through it).
On a side note, there are several different tweaks and options available (like
confHOST_STATUS_DIRECTORY) but there’s usually no compelling reason to add/change those since it would introduce an artificial bottleneck.
Credit to SendMail genius Andrzej A. Filip for the details.
oOoOoOoOoOoOoh! This might be my next board game purchase. #Zombie15
Earl grey tea and a track from Jesper Kyd - a great way to start the weekend.
Source: SoundCloud / jesperkyd
Run A Command On All Files (Recursively) In A Given Windows Path
I sometimes forget that the windows command prompt has the ability to perform loops. Here’s a one-liner for executing a command against ALL files in a given path and all sub-directories beneath it:
for /R "<starting directory path>" %f IN (*) DO foo.exe %f <other switches for foo.exe>
Let’s break this down piece by piece:
for /R "<starting directory path>"tells the loop which area to begin a recursive search in. If you don’t specify a directory path here, the loop assumes that it need to run in the current directory.
%f IN (*)specifies the variable
%fand tells the loop what set of files to match. In this case, I’m using an asterisk to specify any/all files in the directories.
DO foo.exe %f <other switches for foo.exe>executes the command and uses the variable
%fto populate the file name.
Here’s an example without the placeholders:
for /R "C:\test" %f IN (*) DO foo.exe -a -b -c %f
That’s it. Pretty fun stuff!
A down-tempo piece from the soundtrack to Inception: “Old Souls”.
Source: SoundCloud / Eminakaya
New favorite album: “The Greatest Video Game Music”. You’re welcome, Internet.
Source: SoundCloud / Toygar Aksoy
Latest addition to the techno playlist.
Source: SoundCloud / Bas van Straaten
I just learned that the genre “electro-swing” exists. Loving it.
Source: SoundCloud / Siempre es Hoy