A Nation-Sized Battery

If you want to power your home entirely on renewables, the general recommendation is to include enough battery storage to keep things running for 3-4 days without any input (no sun, no wind). This fascinating blog post looks at a hypothetical scenario where we wanted to scale this pattern up to supply the entire United States with enough battery to back up a 100% renewable grid.

He does the math, and comes up with a battery size of approximately one cubic mile. Size is not a problem (it would be distributed), but the cost would be around $25 trillion – more than the annual U.S. GDP. And we know of no source in the world capable of supplying enough lead (he uses lead batteries in the though experiment because they’re 85% efficient and are the cheapest form of battery). So there’s some problem solving to do there, and there are problems with the hypothetical – for example the whole nation would never experience a lack of sun or wind for four days, and we could share extra juice around on a well-distributed grid, eliminating the need for this much battery storage. Or we could come to a fantastic battery breakthrough that changes everything. Or … Good read.

A Nation-Sized Battery

Testing Reusable Django Apps with Pytest

Django project dependencies are normally installed with a simple

pip install myapp

But if you want to be a code contributor to a dependency such as a reusable Django app (or if you are writing one), the usual pattern is to:

  1. git clone that app to another directory, outside of your project
  2. From within your project dir, use
    pip install -e /path/to/the/clone

This creates a foo.pth link and/or a foo.egg-link in your project’s virtualenv, rather than copying the code into the project itself, so you can work on the separate repo and have changes reflected in your project in real time.

That’s all well and good, but if you use pytest and need to run tests in the dependency, just running pytest from your project dir won’t find tests that live in the dependency. So can’t you just run pytest from within the dependency’s directory? Not quite – since it’s a Django app, it’s going to assume access to Django itself, and likely to other apps installed in the Django project, such as users. It would be redundant and cumbersome to install Django in the dependency’s directory, and that still wouldn’t solve the problem of access to users etc.

I can’t seem to find mention anywhere of a “best-practice” solution to this dilemma, but after much futzing around and feeling like I must be missing something obvious I tried what should have been plain from the outset:

  1. From the project dir, pip uninstall myapp
  2. From the project dir, create a symlink:
    ln -s /path/to/the/clone myapp
  3. Add myapp to your .gitignore

Now the separate reusable app appears to Django and to pytest like it’s present in the project, while maintaining physical separation between the project and the dependency. Tests run, and there’s no confusion. Just be sure to .gitignore the symlink.

There’s a gotcha to look out for here: Typically, a reusable app called “myapp” will live in a parent folder that’s also called “myapp”. If you make your symlink to the top-level folder, the imports inside it will not work. You’ll want to create your symlink to the inner folder, e.g.:

ln -s /Users/yourname/dev/myapp/myapp .

Unless I’m mistaken about something, a simple symlink (rather than pip install -e appears to be the easiest way to organize the relationship.

Raising a nerd

“Dad, there’s a mistake in Stranger Things. It’s supposed to be set in 1984, but that periodic table in the background shows an element that wasn’t discovered until a decade later.” (Turned out to be Oganesson 118). Kid has a memory like a steel trap – makes me so jealous sometimes.

How To Screw Up a Good Backup System

I back up our family computers like crazy, using a combination of Time Machine and cloud backup via Backblaze. But I did something dumb and almost lost our family’s entire history of home videos. Facing estimates of $500 – $1500 for professional data recovery, I stumbled on an awesome hack that saved the day.

Background

All of our computers’ internal hard drives get a dedicated external Time Machine, and we use Backblaze for extra insurance, so our data is safe in the cloud in case of fire, theft or flood. But we also have a few external hard drives that store things like large music collections and our home videos. The external drives back up to Backblaze only (no Time Machine).

All of that has been working hunky dory for years, and I felt confident we were safe. Then, a week ago, I realized that the drive that stores our family videos (“Gorgonzola”) would no longer mount, with any cable, on any of our machines. Yikes! So I turned to Backblaze for a restore, only to find it wasn’t showing up there either! Double yikes, freakout.

What Happened

At some point in the distant past, I did something dumb, though I didn’t realize it was dumb at the time – I realized I had lots of extra space on Gorgonzola and decided to let that drive do double-duty, as a Time Machine drive for a laptop. What I didn’t take into account was the fact that Backblaze has a reasonable rule – they don’t back up your backups. So when Backblaze detected that Gorgonzola was now a Time Machine drive, it dropped it from the manifest. I never noticed it had been dropped.

So now I’d realized that I had NO backup available anywhere for this precious, unreplaceable data. So I called some data recovery services, and got estimates ranging from $500 – $1500. The data was important enough to me that I’d pay that ransom, if it came to it. But of course I didn’t want to.

So Crazy It Just Might Work

The next day, I stumbled on a brilliant suggestion: Often, when a drive won’t mount, it’s because the USB controller circuit board inside the drive case has gone south, and that the drive itself is fine. Solution: Purchase an identical drive, take them both apart, and swap the controller chips. Brilliant! Found an identical drive on Amazon for $100 (Seagate Backup Plus Slim), and went for it.

Prying the case open and removing the drives turned out to be easier than expected (YouTube video), and the controller chips slipped off easily. Quick swaperoo, and lo and behold, it worked! Gorgonzola showed up as normal, and I’m rescuing my data right now. Of course, both drives were destroyed in the process, but at this point, I don’t care.

Yay, internet.

Help Us Support the Bay Area Ridge Trail

This Saturday (Apr 22 2017), our family will be hiking 17 miles to help raise funds to complete the Bay Area Ridge Trail – your contributions most welcome!

The vision of the Bay Area Ridge Trail is a 550-mile continuous loop that traces the ridgeline above San Francisco Bay. 370 are currently open for hikers and cyclists. Help us break 400 in the next three years!

Fundraising page

Skeptoid on Rhino Horn

In the mid 2000s, a rumor circulated that an unnamed politician in Vietnam had been cured of cancer by consuming powdered rhino horn. Fast forward 17 years, and rhino horn is now worth around $25,000/pound on the black market. That rhino that was shot by poachers and had its horn removed with a chainsaw in the middle of the night at the French zoo a few months ago? Its horn was like a quarter-million-dollar pile of gold sitting out in the open.

Not only is there NO science on the anti-carcinogenic properties of the keratin in rhino horn (chemically the same as your own fingernails), the belief isn’t even derived from ancient Chinese health literature. All of this literally stems from one rumor gone viral, combined with public willingness to buy into rumor as truth. Rhino species are going extinct rapidly, and poaching is a huge part of the reason why.

The Skeptoid podcast is one of our national treasures, as far as I’m concerned. This episode is particularly good.

Rhino Horn: Cure or Curse?

Believe, Believe

Believe in this. Young apple seeds,
In blue skies, radiating young breast,
Not in blue-suited insects,
Infesting society’s garments.

Believe in the swinging sounds of jazz,
Tearing the night into intricate shreds,
Putting it back together again,
In cool logical patterns,
Not in the sick controllers,
Who created only the Bomb.

Let the voices of dead poets
Ring louder in your ears
Than the screechings mouthed
In mildewed editorials.
Listen to the music of centuries,
Rising above the mushroom time.

~Bob Kaufman

Iceland 2017

Just returned from nine days in Iceland – two days of work and seven days of pure exploration. It was winter, so days were short, and it was gray/stormy the whole time, so no Northern Lights for me, but the trip still managed to blow my mind. Misc notes and photos below. For lots more photos, check out my

Flickr Album – Iceland 2017 (full-screen please!)

Iceland driving tip: While it might be tempting to tune in to the Icelandic death metal station while wending your way through miles of snow- and moss-covered lava rock, one notch up on the dial is the “public culture” station, where the only words you can decipher from the lilting Elvish language are “Yoko Ono,” “Steve Reich,” and “John Cage” (and then they play them).

Blue Lagoon - Waterfall

That station works way better with the landscape. No sleep in 36 hours, but made it to the Blue Lagoon, where 464-degree superheated geothermal water from half a mile down in the earth brings up white silica powder which meets cold sea water, creating these gorgeous warm swimming holes; the color of sky refracts off the silica in the water, making it intensely blue in the right conditions (it was more greenish today). Allegedly great for psoriasis sufferers. Exhausted but blissed.

Blue Lagoon Selfie
Continue reading