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. ...

June 2, 2017 · 1 min · birdchan

Internet Trends 2017 Report

[slideshare id=76530316&doc=internettrends2017report-170531162415]

May 31, 2017 · 1 min · birdchan

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

May 31, 2017 · 1 min · birdchan

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

well said.

May 29, 2017 · 1 min · birdchan

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. 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. ...

May 27, 2017 · 1 min · birdchan

Vim Adventures

An interesting mini game to learn vim. https://vim-adventures.com/

May 23, 2017 · 1 min · birdchan

How 5 Tech Giants Make Their Billions

ref: http://www.visualcapitalist.com/chart-5-tech-giants-make-billions/

May 23, 2017 · 1 min · birdchan

How to reset iphone/ipad without the icloud password?

The icloud prompt could keep coming up asking for the icloud password. It sucks when you forgot the icloud password, and at the same time forgot the password to your corresponding email. Factory reset (Settings -> General -> Reset) won’t do it, coz after the reboot it will again keep asking you for the icloud password. And there is no way to log out or switch the existing icloud login username. ...

May 20, 2017 · 1 min · birdchan

HTTP security headers

This post has really good info on HTTP security headers. https://blog.appcanary.com/2017/http-security-headers.html X-XSS-Protection Content Security Policy HTTP Strict Transport Security (HSTS) HTTP Public Key Pinning (HPKP) X-Frame-Options X-Content-Type-Options Referrer-Policy Cookie Options

May 19, 2017 · 1 min · birdchan

Why does Python 3 round half to even?

Python 2 [code language=“python”] round(3.5) => 4.0 round(4.5) => 5.0 [/code] Python 3 [code language=“python”] round(3.5) => 4 round(4.5) => 4 [/code] Mainly because: to take away the round-up bias. the result can be further divided by 2, and still an int https://mathematica.stackexchange.com/questions/2116/why-round-to-even-integers https://en.wikipedia.org/wiki/Rounding#Round_half_to_even

May 7, 2017 · 1 min · birdchan