Geo contribution to Python faker lib

Like most devs, I often have a need to generate tons of fake data to fill out models – addresses, usernames, “news” content, locations, IP addresses, you name it. Data-mocking libraries are invaluable for creating data factories for use in unit tests, and for populating a site under development with realistic content. For Python, I use the Faker lib in conjunction with FactoryBoy.

Recently I was working on a site that required generating a lot of maps, and realized that randomly chosen geographical coordinates were most often over ocean (since earth is mostly water). Realizing that the right way to solve this was to include a hash of locations known to exist on land and to then pull randomly from those, I started a pull request, which evolved over the past few weeks into a whole new geo module for the lib.

I started with the open source data sets at GeoNames, converted one of their databases into a Python tuple, then extracted every fifth entry to keep the dataset down to a manageable size. Pretty certain I’ve got every country on earth represented, but let me know if you find any missing.

I ended up bringing geographic features from other Faker modules into the new geo module, and added the ability to specify the country you want random land coords for. As of this morning pull request merged!

RIP, Hardy Fox of The Residents

I’m way too late paying my respects to Hardy Fox, one of the anonymous eyeballs of The Residents, a band I stumbled upon as an adolescent browsing the dusty bins at SLO’s original Cheap Thrills in the Creamery. Duck Stab came first, but it was 1980’s “Commercial Album” that really got me – 60 tracks of exactly one minute each (ask me to recite a lyric). The intersection of surrealism and rock never let go – I still return to it from time to time. In 1989 I finally had the opportunity to see them live, in a performance that turned out to happen in a 400-yr-old German bank, floors and walls of white marble – it was the 3rd installment of the Mole Trilogy, and I was transported. Truthfully, I did not know the name Hardy Fox until he died, that’s how anonymous they were. But thank you Hardy, for a lifetime of strange music.

Hardy Fox, of the Avant-Garde Band the Residents (Maybe), Dies at 73

Hardy Fox, of the Avant-Garde Band the Residents (Maybe), Dies at 73

He never admitted that he performed with the group, whose members remained anonymous behind masks as they playfully subverted rock conventions for decades.


Let’s Move to 100% Vote-by-Mail

22 states have a vote by mail option. Three states: Washington, Oregon, and Colorado, are now set up to vote ONLY by mail. Every potential voter gets a ballot mailed to them – no questions asked, no hassle. These states save tens or hundreds of millions of dollars running elections, put to rest all of the questions and vulnerabilities of voting machines, and maintain a tangible paper trail (even texting you confirmation when your vote is received). We need to put an end to polling places being used as tools of voter suppression, and this solution seems like a no-brainer to me. Bring it on, in all 50.

Unemployment Rate Plummets!

U.S. unemployment rate is at an all-time low! I mean, just look at the data! Oh, wait. Blue line = Obama inauguration, red line = Trump inauguration.

May as well look at the Down Jones while we’re at it (the stock market):

Notice a trend?

Data: U.S. Bureau of Labor Statistics.

Eight Million

Visualize eight million of something, anything. Now visualize a metric ton. Now visualize eight million metric tons. That’s how much plastic enters our oceans every year. Mind boggling.

After posting last week about how just nine rivers in the world account for most of the plastics in the world’s oceans, I heard from a group called Sustainable Asia about a podcast series they’ve produced about ocean plastics, the challenges of plastics recycling, the conundrum of incineration (waste-to-energy), and the programs China is undertaking to address its role in the crisis. I listened to it over the course of a week and it was so good I’m starting over. Super recommend (though it takes a bit to really ramp up).

May Contain Dinosaurs

When people say “fossil fuels” they think of fossils, which makes them think of dinosaurs, which makes them think fossil fuels are made of dinosaurs. But that is far from truth. Actual dinosaurs make up a teeny, tiny percentage of fossil fuels, which really represent the carbon leftovers of ancient moss and other plant matter. Think of how much biomass you get when you rake leaves a few times a year. Multiply by the earth’s surface, and that by millions of years. If a few lizards found their way into the pile, fine. “May contain dinosaurs.”

Truly Socialist / Truly Capitalist

There are no truly socialist countries in the world, if you’re going by strict definitions. Neither are there any truly capitalist countries in the world. All countries have some regulations to protect the less fortunate, and all countries have some regulations to prevent the effects of runaway capitalism. There is a spectrum of regulation and a spectrum of social safety nets. “Socialist” usually just means “More socialistic than my country” and vice versa for “capitalist.” The only question is where you want your country to exist on these spectrums. Great answer at Quora.

10 Rivers Responsible for 95% of Ocean Plastics

95% of ocean plastics enter the water via rivers in China, India, and Africa. As important as it is to find ways to reduce our own plastic consumption/waste, and to continue finding ways to clean up the existing gyres, we need to focus on ways to help other countries improve their waste management, and to help them install massive filtration systems at the outlets of these rivers. Starting with the Yangtze.

Trash rivers: these 10 rivers are responsible for most plastic that flows out to the seas

Trash rivers: these 10 rivers are responsible for most plastic that flows out to the seas

Just ten rivers are responsible for up to 95% of all river-borne plastic trash that ends up in the sea. Silver lining: cleaning them up would have a huge positive impact.


David Byrne’s American Utopia

Super-enjoyed seeing David Byrne’s “American Utopia” tour at The Fox last night – minimalist but energetic. A dozen musicians on stage in gray suits, barefoot. No drum stand. No amps. No wires. Nothing but empty space for them to move in. Mostly quirky choreography, but some of it free-form. Body patterns, shadow dances, energy and sweat. Byrne still a force of nature, traces of the Stop Making Sense film. Have to confess I don’t love all of the new material, but half a dozen or so older Talking Heads tracks woven in – I Zimbra, Naive Melody, The Great Curve, Once In A Lifetime, Born Under Punches, Burning Down the House (ecstatic!). And resurrection of the protest song (there aren’t enough of these anymore, what happened?). Great night out.

Photo credit: Phoenix New Times