Implicit structure

Every company has a structure. If you don’t explicitly define your structure, then you are left with an implicit one, and that can stifle productivity. We had hoped that being flat would let us move faster and be more creative, but as we grew, we ended up with an unspoken hierarchy that actually slowed down our ability to execute.

ref: https://wistia.com/blog/ditching-flat

Error starting host: Error getting state for host: machine does not exist.

If you ran minikube start and got that error, below could be the steps to fix it. I assume you have already installed minikube (v0.19.1), kubectl (v1.6.4), and virtualbox (v5.1.22). If not:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.19.1/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.6.4/bin/darwin/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/

Then download and install virtualbox at: https://www.virtualbox.org/wiki/Downloads

Now, see if you have the minikube dir

ls -l ~/.minikube/machines/

If so, see if there are files inside. Chances are that you have some out-dated files.

ls -l ~/.minikube/machines/minikube/

Remove them. Don’t worry, we will download the files back.

rm -rf ~/.minikube/machines/minikube/

And remove the existing minikube vm at virtualbox if you have one.

Search for minikube- at https://storage.googleapis.com/minikube/. As of June 2017 the latest version is minikube-v0.19.0.iso, just look for the latest one.

Then ask yourself how much space you want to allocate to the minikube virtual machine. If you don’t specify, it will be 20Gb by default. Let’s say we want to use 2Gb only (which is the minimum requirement).

Issue this to start minikube.

minikube start --disk-size 2g --vm-driver=virtualbox --iso-url="https://storage.googleapis.com/minikube/iso/minikube-v0.19.0.iso"

Starting local Kubernetes v1.6.4 cluster...
Starting VM...
Moving files into cluster...
Setting up certs...
Starting cluster components...
Connecting to cluster...
Setting up kubeconfig...
Kubectl is now configured to use the cluster.

If anything fails, add the –v=9 flag, that will give you lots of debugging info.

To double check, do cat ~/.kube/config, you should have something similar to the following.

apiVersion: v1
clusters:
- cluster:
    certificate-authority: /Users/brian/.minikube/ca.crt
    server: https://192.168.99.100:8443
  name: minikube
contexts:
- context:
    cluster: minikube
    user: minikube
  name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: minikube
  user:
    client-certificate: /Users/brian/.minikube/apiserver.crt
    client-key: /Users/brian/.minikube/apiserver.key

Then deploy echoserver. It should have no errors.

kubectl run hello-minikube --image=gcr.io/google_contrainers/echoserver:1.4 --port=8080

ref: http://discoposse.com/2016/11/05/getting-started-with-kubernetes-using-minikube/

Build a nested dict in python

Given X = [[‘A’, ‘B’, ‘C’], [‘A’, ‘B’, ‘D’]]
generate Y = {‘A’: {‘B’: {‘C’: {}, ‘D’: {}}}}

This has real-life applications say when you want to build a lookup tree for a file directory.

I thought using a recursive call would be the right way, but I had a hard time passing a node down to the next recursive call. It turns out there is no need to use a recursive function.

X = [['A', 'B', 'C'], ['A', 'B', 'D']]
Y = {}
for path in X:
    current_level = Y
    for part in path:
        if part not in current_level:
            current_level[part] = {}
        current_level = current_level[part]

ref: https://stackoverflow.com/questions/7653726/how-to-turn-a-list-into-nested-dict-in-python

Internet Trends 2017 Report

Free stock photos

http://www.gratisography.com/
https://magdeleine.co/
https://www.pexels.com/
https://picjumbo.com/
https://pixabay.com/
http://raumrot.com/
https://unsplash.com/
https://visualhunt.com/
https://www.goodfreephotos.com/

Source: https://hackernoon.com/8-amazing-sites-with-best-free-stock-photos-5a7e8aff8a59

A ship in harbor is safe, but that is not what ships are built for.

well said.

Concurrency vs Parallelism

In a few words,

Concurrency is like talking and drinking, you can switch back and forth but you cannot really do both at the same time. Parallelism is like walking and drinking, you can actually do both at the same time.

Concurrency_vs_Parallelism

When you have only one cpu, you can only do concurrency. The overall time spent is the same as running in series. When you have multiple cpus, you can actually run things in parallel at the same time. The overall time spent can be a lot shorter.