Monthly Archives: June 2017

Quick Update

I’ve been blogging more, not sure why…

Waterfront Sunset
  • Week of 19-25 June.
  • Monday, office, cold and rainy day, promenade walk with Kirsty, wrote a blog post about why you must listen to podcasts, sunset promenade walk, pizza special at La Vie with Paul.
  • “Ideas are always at war.” — JP, listen to the 2nd Joe Rogan interview with Jordan Peterson.

  • After listening to Joe Rogan I just want to do yoga.
  • Joe Rogan gets 120mil downloads/m. Wow.
  • Tuesday, podcast walk to the office, Sababa lunch, played with Django admin-interface themes, sunset walk home, some reading and researched an FRR topic.
  • “You can’t be a good person until you understand your capacity for evil. The morality comes when you are a monster and you can control it.” — JP

  • Love how Sivers talks about designing and building your own little world. Makes it fun.
  • Creativity is the most important thing. No adventure is. No…
  • Quick reminder than we are / have been living in the best time in history.
  • Wednesday, office, MWEB meeting, put on my Hugo Boss corduroy jacket (for the professor look) and took an Uber ride to the Old Mutual Trophy Wines Masterclass presented by Michael Fridjhon on the 28th floor of the Portside building – rad venue, fun evening with Paul, Hanno and Danielle, cool tasting, loved the Verdelho, time well spent.
  • “Don’t be late please.” — Paul, about the wine function. Very amusing.

  • Winter solstice. Hello summer.
  • The Shackles of Marriage.
  • Thursday, office, catch up with Dave at Knead, upgraded seven WordPress installs to 4.8, catch up with Warwick and Giles in Obs, researched CI tools – GitLab seems cool, DevOps meetup at 22 Seven’s office – interesting talk involving SaltStack, phone chat with Mia.
  • I think I’m turning into a NetDevOps nerd… or, maybe just rediscovering my nerdiness.
  • Funny how quickly your life can go from lots of driving every day – to pretty much not using your car.
  • Friday, office, dev meeting, fetched Mia, afternoon and pizza making at Dirk’s, 11h sleep.
  • Saturday, watched Get Me Roger Stone, Mia watched Man of Steel, great breakfast and a backgammon game at CaffeNeo, a walk around Green Point Park, we watched Pirates of the Caribbean: Salazar’s Revenge at the Waterfront – entertaining, gelato, sunset walk along the Waterfront shoreline, dinner at Tashas, we watched Zoolander – Mia loved it, time well spent.
  • Lazy: responding to SMS messages by typing a note which syncs to your phone and then cut-and-pasting it.
  • Sunday, watched some Supergirl on Netflix (a bit like The Devil Wears Prada meets Spiderman), Mia finished a 3D puzzle a few times, wrote a blog post about why you must use 24h time, Hout Bay Market with Mia, a walk around the harbour, gelato, Glen Beach and a walk around Camps Bay beach, sunset promenade walk, we watched Ferris Bueller’s Day Off again while I wrote a blog post related to a chat I had with Mia earlier in the day about why universal basic income is not such a great idea, time well spent.

Have a fun week, crazy kids.

Universal Basic Income Is Not The Answer

What do we do when automation systems and robots make the mundane jobs redundant?

We could teach people new skills and let them find other jobs. This might negatively impact people who are already in these jobs. New skills might work for a small percentage of people.

We could ask some people to assist the robots and manage them. That could keep some people working.

The popular answer seems to be: Universal Basic Income.

Many countries probably can’t afford universal basic income, but let’s look past that for a moment.

The cost of living will probably go down a lot in the next twenty years as things get much more efficient. Producing food, transport, housing can all be done much better by machines. We could tax the profits made from the labour of the bots.

The idea with universal basic income is that governments give everybody some money to cover the costs of food and shelter. If there is no need for boring and mundane jobs people will be free to enjoy their lives and be creative. Write novels, make art, make movies, write music etc.

I’d like to think this is true, but I don’t see it working out this way.

Trouble is, only about 5% of people are creative and ingenuitive… and this 5% will probably not be replaced by the bots in the near future.

What are we going to do with all the people that currently drive cars and trucks for a living? It’s a fairly big problem, I think.

Xbox, endless social media feed scrolling, virtual reality and pain killers.

Not ideal. Any better ideas?

Universal Basic Income is not the answer.

Living in big cities without something to do and keep us busy is going to be a mess… unless you like the idea of a mashup of Wall-E and The Matrix.

Let’s try distributed living. Smaller communities. Small towns. Off-grid, sustainable, solar, clean-tech, long distance fibre optics, aquaponics etc. Something to build and do. Get farming again.

We don’t need cities anymore.

ps. I’d really like to see government taken over by machines. Humans don’t have the best track record with running countries. Give the bots a chance.

UPDATE 26 July 2017:

I think a number of people mis-read this post thinking that I’m against giving (poor) people money to pay for their basic needs. I don’t have a big problem with this.

My point with this post was to explore: what will be our reason to get out of bed in the morning when robots do most of the work? What will fulfil us in a useful and productive way? In short: purpose.

My latest answer is:

  • Off grid living in smaller communities, connected with high speed fibre.
  • Modern farming: aquaponics, aeroponics etc.
  • Educating our children. A society of educational abundance.
  • Educating ourselves. Long term continuous learning.

Previous posts in my Strong Opinions series.

Afrikaans Spell Check for macOS and iOS

How to add Afrikaans spell checking and dictionaries to macOS 10.12…

I use Telegram Desktop a fair bit and it bugged me that Afrikaans spell checking was missing. Here is my current solution. I’m not sure it’s 100% tip-top, but it’s much better than it was.

Dictionary

Download these, unzip and copy into ~/Library/Dictionaries.

Open Dictionary.app, look in Preferences, enable the new dictionaries and move them into the order you want them.

Spell Check

Download en_af_ZA.zip, unzip, copy to ~/Library/Spelling. I found this on the translate.org.za site a few years back.

Settings > Keyboard > Text > Spelling drop down

Scroll down to “Set Up…” and enable Afrikaans.

Now set that drop down to Automatic by Language.

iOS

Just install SwiftKey app and enable Afrikaans.

Now, if only Telegram Desktop (Qt on macOS) would support spell checking. Until then, I’ll just have use the macOS Telegram app.

Use 24h Time

Use 24 hour time when you write something. Set all your devices to 24 hour time. Yes, your watch too. Life is too short to decode confusing messages.

09:00 or 21:00, not 9.

How do you even start explaining the Six-hour clock?

Bonus points:

Set all your servers to UTC. Especially if you have servers in more than one timezone.

Previous posts in my Strong Opinions series.

Quick Update

Wrath of the Kahns, Debian 9 and three rounds of Van Hunks…

Sunset Walk
  • Week of 12-18 June.
  • Health week 1/3, kinda.
  • Monday, school run, photo processing with some senior citizens in the Spur, gym with a Taylor Swift soundtrack (after Mia loaded it on my phone), podcast drive to the office – Wrath of the Kahns, League of Emotionally Unavailable Gentlemen late lunch at Sundoo with Paul, bumped into somebody I met at Wolfkop, aimless sunset walk past Clifton with an Alt-J soundtrack, dinner at Georg’s house.
  • I bugged Telegram to add a feature so I can not receive voice notes. No response.
  • Notes from the Kahns series… Stir things up. Cause some creative destruction.
  • “The truth burns off dead wood.” — JP

  • “I felt like putting a bullet between the eyes of every Panda that wouldn’t screw to save its species. I wanted to open the dump valves on oil tankers and smother all those French beaches I’d never see. I wanted to breathe smoke. I felt like destroying something beautiful.” — Fight Club

  • Tuesday, office, lunchtime podcast walk, stayed in the office till pretty late, dinner with Wouter and Shaun, did some VPP reading.
  • Calm is a superpower.
  • “Remember that we are not descended from fearful men – not from men who feared to write, to speak, to associate and to defend causes that were, for the moment, unpopular.” — Edward R. Murrow

  • Wednesday, up early, cat typing at Silo gym, swim, office, played with Docker for Mac, dinner at Dennis and Hugo’s house with Georg – looks like I’m going to house-sit for a while.
  • So yeah, for the next week or so, I might be one of those people that can’t stop talking about Docker.
  • The Terrors of Being Loved.
  • Thursday, office, dev meeting, catch up with Fred and Caley, Myog, sunset promenade walk, dinner with Wouter, listened to some Rachmaninov and Brahms by the Cape Town Philharmonic Orchestra at the Cape Town City Hall with Georg and Al, Van Hunks with Georg and Tanya – memories of talking to Ryan about creating something from nothing – zero to one.
  • I finished listening to The Wrath of the Kahns series, 8hours+ epic history lesson, very good.
  • Friday, public holiday, felt sorry for myself for about an hour, drove to Stellenboch, nice catch up with JM, late afternoon Chardonnay drinking and dinner at Dirk’s, Van Hunks round two with Georg, in bed early.
  • I’ve been happily nerding away on a project over the last two weeks. Nice to learn and design interesting things.
  • Saturday, happy Debian release day!, reading and tinkering with an old Macbook Pro, Van Hunks round three, watched the rugby – good game, fun evening with Georg, Al, Diabi, Pierre, Stefan and Hilah, ended up at Pierre’s place, time well spent.
  • I have an old mid-2009 Macbook Pro which can’t be upgraded to macOS 10.12, so I figured I’d install Debian 9 on it and check out Wayland. I’ve also been keen to play with KVM.
  • This makes me happy: Debian 9 Released.
  • To celebrate the Stretch release, we have more than 45 parties in 25 different countries. Debian 9 Stretch is dedicated to the project’s founder Ian Murdock, who passed away. The Debian project started in 1993. At least 1436 people contributed to Debian in 2017. It comes with over 51,000 packages… how cool is it that about 1000 people can build something this rad!
  • “This is not 99pi. I am Roman Mars.”

  • Sunday, Hussar Camps Bay lunch with Georg, installed Debian 9 on a Macbook Pro and played with Wayland and Sway, wrote a blog post about getting Debian running on a Macbook Pro.
  • I figured I should start a blog category for technical posts: Muppet Labs.
  • Tune of the week: Elton John – Tiny Dancer. Yeah.

Have a fun week, crazy kids.

Listen to Podcasts

Radio killed the video star…

In the future everybody listens to podcasts

Start listening to podcasts today! Use spare cycles – while driving / walking etc.

Listening to stories lights up a huge number of areas in your brain. It’s probably good for you. The joy of learning. Stay curious.

Podcasts offer an incredible storytelling medium. They’re made with passion, accessible and entertaining. You basically get the very best radio content from all over the world, for free.

Upgrade your brain

Start here:

Some of my favourite podcast episodes.

A list of podcast shows to get you started.

Previous posts in my Strong Opinions series.

Install Debian on a Macbook Pro

How to install Debian 9 on an old-ish Macbook Pro.

In the future, everybody will run Debian – the universal operating system. Don’t resist. It’s way cooler than macOS. Install Wayland and Sway.

Re-install macOS. Partition the drive and give macOS about 40GB space. Keep the rest for Linux.

Get the Debian ISO: debian-mac-9.0.0-amd64-netinst.iso Note: you may want to download the one with non-free firmware. I just used the standard one.

Prep USB drive:

hdiutil convert debian.iso -format UDRW -o target.img
diskutil list
diskutil unmountDisk /dev/diskN
sudo dd if=target.img of=/dev/diskN bs=1m
diskutil eject /dev/diskN

Download rEFInd binary zip file. Unzip and run the refind-install script on the Macbook Pro. You should now have a nice boot menu.

With USB drive in the laptop, reboot and hold down the Alt key.

Follow the Debian install process, and make sure you select the Linux partition you created, in my case it was /dev/sda4.

Use the Ethernet port and connect to the internet. You may need to install the wifi firmware:

apt-get install firmware-b43-installer

Quick Update

Stormy week…

Cape Town Storm
  • Week of 5-11 June.
  • Monday, woke up in Matjiesfontein, road trip to Cape Town with Georg, office, sunset promenade walk, watched the Apple event with Heleen.
  • Tuesday, office, phone chat with Cath, breakfast for lunch at Kleinsky’s, some photo processing, wrote a blog post about some Django setup notes, sunset promenade walk, some server tinkering and backups.
  • “I’m not miserable. I’m dissatisfied. That’s what makes me a success.” — She’s The One

  • Wednesday, up early – woken up by the storm, some newsletter writing, crazy stormy day – sideways rain, Arista event in Century City, office, impressive waves around Sea Point, went home, had some red wine – watched the crazy weather and read a technical manual, epic rainy weather nap, 1/2 price tacos at La Vie with Georg – their “Point Break” special, listened to Mona Lisas & Mad Hatters a few times.
  • Mona Lisas & Mad Hatters – Elton John
  • The Black Keys – Little Black Submarines
  • Worth a re-watch: Can Exes Be Friends?
  • Learn To Do Everything Lightly
  • Thursday, sent a newsletter, office, Old Mutual Trophy wine show public tastings at the CTICC with Paul – good fun, thanks Paul, dark chocolate, in bed early, slept like the dead – sinus meds and wine.
  • Wine I liked the most: The Eleanor 2012 Chardannay from Hartenberg.
  • Friday, office, haircut, fetched Mia, dinner with Dirk at Piza e Vino in Stellenbosch with a paper jet folding and flying competition – I won (-:
  • Saturday, cold and rainy day, breakfast at Jarryd’s with Mia, Wouter and Zander – not bad, but I’m a bit over Jarryd’s – bad value, Waterfront with Mia, we found her the 3rd School for Good and Evil book, we watched Wonder Woman – pretty good – but not as good as Aliens in the strong female lead category, gelato and a walk around the Waterfront with Mia, sunset promenade walk, bumped into Cath and walked with her for a while, soup and red wine with Mia, dark chocolate, some Famous Grouse, culled about 70 saved Facebook links, watched a bit of Back to the Future.
  • I finally finished listening to the YC / How to Start a Startup podcast series.
  • “You seem to have a thing for overly complicated woman. Just stop that.” — Wouter

  • Sunday, tea and backups – I found Wrath of the Kahns podcast series on and old laptop – been meaning to listen to it for ages, grapefruit, passion fruit and photo editing while Mia watched Full House (1987) on Netflix, matcha flapjacks at Scheckter’s Raw – hmm, they changed their recipe, wintery promenade walk with Mia – I used the remote camera feature on my Apple watch + iPhone for the first time – joy, some home speedtests and troubleshooting, dinner with Mia, Wouter and Shaun, made a 2nd Jolp set for Mia – 12 episodes – mostly 99pi, Radiolab and What It Takes, time well spent.
  • Amusing episode of Full House – where they promote low fat / fat free food. The 80s and 90s man. What a food disaster.
  • Mia’s iPhone ran out of space, so I figured I’d show her how to download and edit her photos, make backups, and then put a best-of/memories album back on her phone. I think 90% of iPhone users have full/slow phones just waiting to loose all their photos. People are monkeys.
  • Paul rebooted his Instagram account – for his new and improved food/lifestyle blogger persona.
  • I had a Harajuku Moment this weekend. Need to be less lazy again.
  • I updated my use this tech post.
  • Tune of the week: Elton John – Tiny Dancer

Have a fun week, crazy kids.

Django Setup Notes – Ubuntu, Nginx, uWSGI

muppetlabslogo

Notes for getting Django running on Ubuntu 16.04… with Nginx, Supervisord, uWSGI in emperor mode and a bit of Postgres.

Start by setting up your Ubuntu environment.

Newish Python 3.6

add-apt-repository ppa:fkrull/deadsnakes
apt-get update
apt-get install python3.6
apt-get install python3.6-dev
apt-get install python-virtualenv

Postgres

apt-get install postgresql postgresql-contrib
su - postgres
createdb myapp
createuser -P

You may need to dump a database and import it again…

pg_dump -U myuser myapp > myapp.db
psql myapp < myapp.db

SSL Cert Setup

Grab a free SSL cert…

service nginx stop
apt-get install letsencrypt
letsencrypt certonly --standalone -d www.myapp.com -d myapp.com
service nginx start

Nginx

apt-get install nginx

This should give you a nice and secure HTTPS setup which also supports HTTP2…

/etc/nginx/sites-available/myapp.com


server {
server_name www.myapp.com;
listen 443 ssl http2;
charset utf-8;
client_max_body_size 75M;

ssl on;
ssl_certificate /etc/letsencrypt/live/www.myapp.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.myapp.com/privkey.pem;

ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers On;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';

ssl_session_cache shared:SSL:128m;

add_header Strict-Transport-Security "max-age=31557600; includeSubDomains";
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Xss-Protection "1";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' *.google-analytics.com";
add_header Referrer-Policy origin-when-cross-origin;

ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8;

access_log on;

location /static {
alias /var/www/www.myapp.com/api/static;
}

location / {
uwsgi_pass unix:///var/www/www.myapp.com/api.sock;
include /var/www/www.myapp.com/uwsgi_params;
}
}

/var/www/myapp/uwsgi_params


uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;
uwsgi_param UWSGI_SCHEME $scheme;

Django Virtual Environment

cd /var/www
mkdir www.myapp.com
virtualenv -p /usr/bin/python3.6 env

cd /var/www/www.myapp.com
source env/bin/activate

git clone https://github.com/myco/myapp.git api

Note: my Django app name is “api” here.

pip install -r api/requirements.txt

pip install Django
pip install uwsgi

Install uWSGI System-wide

Using the latest Python, install uWSGI in /usr/local/bin…

Make sure you are not in a virtual environment or run “deactivate”.


python3.6 -m pip install --upgrade pip
python3.6 -m pip install uwsgi

Supervisord to Manage uWSGI in Emperor mode

apt-get install supervisor

/etc/supervisor/conf.d/uwsgi.conf


[program:uwsgi]
command=/usr/local/bin/uwsgi --emperor /etc/uwsgi/apps-enabled
autostart=true
autorestart=true
redirect_stderr=true
stopsignal=QUIT
stdout_logfile=/var/log/uwsgi.log

Setup /etc/uwsgi

cd /etc
mkdir uwsgi
cd uwsgi
mkdir apps-available
mkdir apps-enabled
cd apps-available

/etc/uwsgi/apps-available/myapp.ini

[uwsgi]
uwsgi-socket = /var/www/myapp/api.sock
pythonpath = /var/www/myapp/api
virtualenv = /var/www/myapp/env
processes = 2
reload-on-rss = 150
module = api.wsgi
uid = www-data
gid = www-data


cd /etc/uwsgi/apps-enabled
ln -s ../apps-available/myapp.ini
service supervisor restart

You can now also edit / touch your myapp.ini to make uwsgi restart the worker processes.

Done. Test your setup.

Go make some tea and start coding.

More Notes

Let me know if something above can be done better.

Tune your Postgres database. Then su – postgres and run “pg_conftool show all” to see that your setting are up to date.

Tune your SSL setup.

You probably want 2x uwsgi processes for every CPU in your server.

Update: use pipenv

pip3 install pipenv
cd /project
pipenv –three –python /usr/bin/python3.6
pipenv shell

to use:

su – www-data (or user which runs uwsgi)
pipenv shell

Quick Update

Matjiesfontein Wolfkop and HTTP2…

Matjiesfontein
  • Week of 29 May to 4 June.
  • Monday, extended school run – the N2 was closed because of a protest, fetched a hoodie from JD, gym, swim, office, smoothie with Heleen, sunset promenade walk, catch up with Georg and Nick at the Winchester with a Caipirinha and some authentic South American Cachaca.
  • I was in the news: Workonline taps into Octotel’s FTTH network.
  • Seems telco nerds are pretty happy.
  • Rational People: Use data and reason to arrive at truth. (This group is mostly imaginary.)

    Word-Thinkers: Use labels, word definitions, and analogies to create the illusion of rational thinking. This group is 99% of the world.

    Persuaders: Use simplicity, repetition, emotion, habit, aspirations, visual communication, and other tools of persuasion to program other people and themselves. This group is about 1% of the population and effectively control the word-thinkers of the world.

  • Tuesday, podcast walk to the office, dev meeting, took a lunchtime walk to Sababa – bumped into Philippa, walked to Michael’s, design session with Michael and Chris, walked home, El Burro supper and a chili margarita with Wouter, Anderson and Shaun.
  • Ludwig van Beethoven’s 9th symphony stretched to 24 hours.
  • Happy to report that my Qwerty shortcut key habit is now a thing of the past.
  • Wednesday, office, ramen for lunch at Three Wise Monkeys – very good, lots of systems testing, catch up chat with Gys at Mojo Market, La Vie with Georg, tinkered with uWSGI and supervisord.
  • Thursday, office, a glass of wine at Dirk’s house, took a walk from Cath’s house to The Blue Cafe, catch up with Cath (back from the US) and Georg, took Heleen some coconut water – she was doing a 24h 100km run through the city… #runningdry100
  • We made the new Octotel automation system and API live this week. Django + REST APIs + some GeoDjango.
  • I upgraded my websites to use HTTP2 and TLS 1.2, so you should now be reading this via HTTP2.
  • “The only people who can still strike us as normal are those we don’t yet know very well.” — Alain de Botton

  • Friday, up early, checked the Octotel API and made a last few tweaks to finish our systems migration, went to go say hi to Heleen at the Mouille Point lighthouse, Point gym, swim, office, road trip to Matjiesfontein with Georg, epic party at the train station.
  • My 3rd Wolfkop adventure. Super fun, as always. Thanks Werner and crew!
  • Saturday, hotel breakfast, bloody mary at the Life Aquatic pool party, high tea and Bloedlemoen G&Ts on the lawn with Georg, Pierre, Stefan and Dawid, party in the transport museum and court house, felt like an endless day, great fun, time well spent.
  • Sunday, hotel breakfast with Georg, chilled afternoon at the transport museum, epic nap, dinner at the hotel with Georg, phone chat with Mia.
  • Tunes of the week: listen to the new Alt-J Relaxer.

Have a fun week, crazy kids.