Category: Office

Bring Blogger images into WordPress, the hard way

You migrate from Blogger to self-hosted WordPress. Your posts move over just fine, but for some reason (or another) your images forget their bus pass. Those pornographic stupid cat, hastily-prepared food, and trying-to-make-people-think-you-are-wealthy-instead-of-deep-in-debt vacation photos still show on the new site as they are properly referenced in the posts, but they actually remain on Google’s servers. You (or your client) don’t like that.

Meanwhile, the two plugins you found to solve this problem, Archive Remote Images and Cache Images, haven’t been updated in years. You take your chances anyway because you are lazy (if it is a personal site), or consistently over-promise and under-deliver (due to the impossibility of getting real work done at coffee shops). Either way, you must now hope you made a full site and database backup beforehand. If you did, you’re solution is now staring you in the face.

The script I concocted (shown after the jump) will get you a folder full of those images – with clean and pretty naming conventions – that you can upload to your wp-content directory, along with a SQL script to update links in your WordPress posts. Said programmatic wizardry dirty hack is written in Python – debugged using version 3.5.2 Anaconda custom (x86_64) on macOS 10.12.3 to be precise – and does rely on some SQL prep work. If you do not know Python, SQL and how to navigate directories while a terminal prompt blinks back, you have two choices: Google it (after determining what the definition of “it” is), or inquire about retaining me to do your work for you.

I’ll make the decision whether to continue easy too; if you cannot execute the following block of code sans assistance you are officially deemed “without paddle” …

SELECT * FROM `wp_posts` WHERE `post_content` LIKE "%blogspot%"
INTO OUTFILE '/home/dump/blogspotposts.csv'
FIELDS TERMINATED BY '|'

That look easy? Then proceed.

First, decide whether to run on your desktop (for future upload) or directly on server. Next, create a directory underneath where the script is located called /bspics. Lastly, make sure the directory the code is in is writable by all.

The code can be found here -> processblogspotimagelinks.py

Once you have changed the obvious stuff to suit your need, run it. Your /bspics directory will fill up with those images I promised – you can then place that entire directory underneath /wp-content – and you’ll also have a file called bsreplacescript.sql which you will run against your WordPress database to update image links in the associated posts.

Important [final] note: the coding was an iterative process, and some data analysis was done between steps in order to account for string possibilities encountered, generating clean file names, etc. It could be refactored, but wasn’t because 1) the end result works as intended and 2) removing those iterations would handicap attempts to modify it for a different data set.

MG signing off (to solve some not-so-commonplace problems)

“Comply with all crew member instructions” and then some

FACTS: People all over will travel all over this holiday season. They will stuff themselves with holiday joy. They will feign appreciation for useless gifts. They will complain about service, especially that purveyed by airlines.

This is but a public service message reminding everyone to comply with all crew member instructions, as well as those printed on the wing of the plane …

do not step out of this area

DO NOT STEP OUT OF THIS AREA (Photo: Yours Truly)

MG signing off (’cause that next one is a doosie)

Plugging mcrypt into PHP on macOS Sierra 10.12

We climbed up then down El Capitan, yet little changed. We’re still in the Sierras, and there’s still work to do.

The following instructions are for peeps a) developing on macOS Sierra 10.12, b) need mcrypt for their PHP development i.e. PHPMyAdmin and/or encrypting personally identifiable data before storage (unlike your health insurer, Yahoo! and/or pretty much every other knucklehead out there), and c) do not want to recompile PHP or run MAMP. Mcrypt will load dynamically with PHP after completing this tutorial.

We begin by acquiring the following stuffs …

1) libmcrypt-2.5.8, which you can find here; download by clicking the one of the two file links (author used “libmcrypt-2.5.8.tar.gz”);

2) PHP 5.6.24 source code, which is available here; [NOTE: you may someday update OS X beyond 10.12, and PHP may get updated along with it; the author used 10.12, and PHP 5.6.24 was included with that OS version. If necessary use php -v to check your version of PHP and then download the PHP source for that version.];

3) Xcode 8.0, which you can get from the App Store. You will also need the Command Line Tools (macOS 10.12) for Xcode, which you get by selecting “Xcode/Open Developer Tool/More Developer Tools…” from the Xcode menu, then logging into your Apple Developer account (yea you need one of those too); and

4) Homebrew (http://brew.sh) which can be installed by typing ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/ install/master/install)" at the command line.

But before we really wind up, let’s turn off System Integrity Protection (SIP):

  1. Click the Apple menu (upper left hand corner of your screen)
  2. Select Restart, then hold down the Command-R keys to boot into Recovery Mode
  3. Select the Utilities menu and then Terminal
  4. In Terminal, type csrutil disable and then hit return; then close Terminal
  5. Click the Apple menu and select Restart

NOTE: When you are done installing mcrypt, you can restart SIP by following the above steps while substituting csrutil enable in step 4.

Proceed.

(more…)

Debt crazy. Make that insanity.

“Insanity: doing the same thing over and over again and expecting different results.” – Albert Einstein

Grant Williams does a heck of a job explaining the situation

MG signing off (because owing nothing means you can)

Blocking Facebook, Completely

A long while back I deleted my Facebook account. Yes it was a large pain in the ass, but not nearly as bothersome as the potential risk of having such a thoroughly untrustworthy group – downright devious if you consider they change their privacy terms seemingly by the hour – holding a constantly updated dossier of oneself. I have avoided the site like the plague since. If I accidentally passed by I would immediately clear browsing history and caches.

Nevertheless, a few months back I observed browser cookies showing up from Facebook, so I added a Little Snitch rule to block all processes for facebook.com.

fb-ls-rule

Soon after I noticed that Instagram photos embedded in sites no longer displayed in my browser. Bonus! I was henceforth free from drunken selfies, cat gonads, and $30 spinach salads laden with moldy cheese and anchovies.

But the question lingered: How many other points of entry might not be blocked here? After all it’s a huge ‘organization’, and they’ve probably conjured a myriad of stealthy domains for the purpose of pinging, tracking, recording, and otherwise intruding. Thankfully I wasn’t the only one asking.

Enter one Jonathan Dugan, technology consultant and entrepreneur from the Bay area. He offers a blocklist for Facebook, via Github, and from the looks of it is an extremely thorough one indeed. Over 880 distinct domains, one heck of a long list.

dugan-github

It is constructed for use on Windows, Mac and Linux; all you need capability-wise is editing your computer’s host file. You can find this dream come true right here.

process-blocked-lsThank you sir.

Meanwhile, I’ve downloaded and edited this blocklist, removing the loopback IP addresses so it can be utilized easily within Little Snitch. You can find that here (plain text 26kb, which will not be updated past today). 100% credit goes to the previously mentioned originator, and copy/paste works like a charm.

MG signing off (safe from prying eyes)

Improving your iPhone’s indoor reception with Wi-Fi calling and some basic network trickery

No shot against AT&T here, but the reception in my home office sucks. It’s probably just the combination of zombie-proof glass, the custom kevlar/copper mesh in the walls, and the tin foil hat I wear, but I called the carrier about it anyway. They suggested I buy one of those mini cell site jobs for ninety bucks. Instead I spent several times that amount for a new phone because I heard it was capable of Wi-Fi calling i.e. using my internet connection to make and receive calls. Sure enough it seemed it was …

phonescreenshot1x

Unfortunately, even after upgrading the network I still experienced warbled voices and dropped calls, meaning pineapple and broccoli pizza showing up at my neighbor’s door. Very bad.

However, all was not lost. With a little network trickery – mostly tinkering with IP addressing and port forwarding – I was able to get consistent Wi-Fi calling. Crystal clear with near zero drops, and my favorite Chinese takeout joint is again accepting my orders. Very good.

Note that the instruction that follow were done using a plain vanilla iPhone 6s and an Airport Extreme, but that doesn’t mean the general premise won’t work with a Samsung Galaxy and old Linksys gear. All is being provided in as layman-esque terms as possible for this reason; technical types providing commentary such as “you didn’t define NAT correctly” will be punished via intentional disregard. Further, everything that follows assumes you have Wi-Fi calling activated. If not, read the instructions here for getting it running.

(more…)

Completed Winter Reading List (inclusive of LSD substitutes)

Winter is supposed to be the time when you relax on the couch, well-tended fire and warming cocktail close by, and spiral into a state of severe depression over your “friends” social media posts read a good book. The absolute value of literary consumption has dwindled yet again, but only because the chimney sweep flew south last December …

The Big Short: Inside The Doomsday MachineMichael Lewis (link)

So the movie just came out (and I already knew the story), but the book is classic Lewis; a thorough – and gripping – tale of monkey business.

Amusing Ourselves to Death: Public Discourse in the Age of Show BusinessNeil Postman (link)

The conceptual transition between the written word and television repeats itself; this time it’s zombies staring at little blue screens instead of big black and white ones.

Alice’s Adventures in WonderlandLewis Carroll (link)

Cannot believe I’d never read this before; like The Bible, a source of many otherwise inexplicable pop-culture references is finally uncovered.

The Moral Landscape: How Science Can Determine Human ValuesSam Harris (link)

“Faith” is the exchange of critical thinking skills (and money) for someone leading you into a pasture; there a creature (of likely sharper intellect) keeps the flock in check while it in turn baas out ways to treat those outside the ring with patronization and/or passive-aggressive disdain; Harris continues proposing alternatives to this malinvestment.

MG signing off (because Spring draws near, or at least Daylight Savings Time does)

Upgrade your network for a quick return on investment

Here is was my network …

routercombo-old

There are many like it but this one is was mine.

At the time this network was in service, the following applied:

  • The monthly service cost was $92.95 excluding tax
  • The bandwidth allocation to the modem was 150Mb per second
  • The throughput directly from the modem was ~99Mbps (with a 10/100 USB adapter, the only one around)
  • The throughput to the laptop sitting 25 feet away ranged from 35Mb to 55Mb per second

In other words, I was paying a pretty penny for bandwidth I wasn’t taking advantage of, using outdated equipment. Some of which I had to pay rent on too.

Here is my new network …

routercombo-new

There are probably a few like it, but I recommend there be more.

It went into service at the following cost:

  • Arris SB6141 Modem – $69.95, with neither tax nor shipping cost
  • Airport Extreme – $139.32 to the front door

The Airport Extreme was added first, and throughput to the same laptop in the same location jumped to roughly 140Mb/second. Then the modem was brought up (with four additional download channels from the previous) but speed didn’t budge. Still, I was now utilizing most all the bandwidth I was paying for.

The next morning I returned the old (rented) modem. Afterward, thinking I didn’t really need 150 megabits – I had been getting along kinda so-so fine with the old 45Mbps (average) – I called my provider to downgrade service. I guessed that 50-75 megs would probably do. Unfortunately, that tier was no longer available, but they did offer a plan at a flat $69.99 that supposedly gave me the same one-fifty I was paying for before, and without a long-term commitment. I said go for it, and here is the result …

networkspeedtest

Excluding any purchase points (which I did use, to the tune of $57.24) or resale value of old equipment (estimated at $50), the investment was $209.27. Sans tax, my service now costs $22.96 less than before; that’s a payback period of just over nine months. Take into account points and equipment resale and it drops to under five. Not bad, and for ~148Mbps of additional, usable speed.

MG signing off (having not so much a need for speed as enjoying the return)

Editor’s notes: 1) results may vary, but these results were mine; 2) investment doesn’t include the hour fifteen I spent on the phone configuring new modems and adjusting plans

A Practical Guide To Getting Started With Bitcoin

Bitcoin is like cold fusion: It’s had a difficult childhood. Those few in the field are orphans, bastards at best.1

I’ve often wondered if Bitcoin would shed its thick glasses and step out into the real world, but until recently I had neither the time nor inclination to find out. However, I follow the commodities markets quite closely, and recently came across mention of it in an ETF manager’s research report. That prompted me to ask around, and what I heard back intrigued me, in an anti-groupthink sort of way.

Bitcoin will never be good for anything except buying drugs; It’s bullshit technology … smartphone games and hookup apps are where it’s at; Bitcoin can’t be used for marketing so why would I want to mess with it?

Shot down, over and over again. But it was the steadfast, verbatim answer to one question that got me thinking:

YOURS TRULY: Do you have any Bitcoin? Do you know how to get any?

EVERYONE: No. And No.

Maybe nothing had changed, and Bitcoin was still an artifice lurking on basement computers and circulating the “dark web”. However, seeing as nobody I talked to had any Bitcoin, mentioned they’d tried to acquire any Bitcoin, or seemed interested in doing so, I surmised this might just be a case of bad press, combined with the inexplicable desire of the self-professed psuedo-technorati to leverage their free time posting geo-tagged photos of their lunch plates.

Hence, I invested some otherwise scarce time to test my contrarian theory.

What follows is the quasi-organized regurgitation of an endeavor seeking out the simplest, most practical way, if any, for the layman to dip their toes in the Bitcoin waters. Cold water too, so those following wouldn’t get burned. It probably isn’t the path of least resistance – it requires a time commitment – but you will not have to spend a dime of your hard earned, government-issued currency to find a pot of gold gather some spare change.

And of course, learn something new. Like does Bitcoin have legs? Does it have any applicability to the present financial system? Can I acquire Bitcoin without meeting some cartel member in a dark alley?

But first, what is Bitcoin?

If you are technically adept I highly suggest reading the original Bitcoin white paper (PDF), authored by the enigmatic Satoshi Nakamoto, inventor of Bitcoin. For the other 99.99%: the Bank for International Settlements calls Bitcoin a digital currency with an embedded decentralised payment mechanism based on the use of a distributed ledger.

(more…)

Completed Autumn Reading List (inclusive of fun and games)

Too much time spent in the officeon the driving range … brushing up on classical Tibetan results in a shorter list than previous.

The Vision of the Anointed: Self-Congratulation as a Basis for Social PolicyThomas Sowell (link)

Marketers Are From Mars, Consumers Are From New JerseyBob Hoffman (link)

Tower of Basel: The Shadowy History of the Secret Bank That Runs the WorldAdam LeBor (link)

Merchants of Despair: Radical Environmentalists, Criminal Pseudo-Scientists, and the Fatal Cult of AntihumanismRobert Zubrin (link)

Mastering Golf’s Mental Game: Your Ultimate Guide to Better On-Course Performance and Lower ScoresDr. Michael T. Lardon (link)

CryptonomiconNeal Stephenson (link)

Select opinion: Tower of Basel is a well-researched, thorough historical account of 20th century war financing; and Cryptonomicon is very long, but I COULD NOT PUT IT DOWN.

MG signing off ( རྗེས་མ་མཇལ་ཡོང་། )