The aha moment of value investing
During the period 2010 onwards, I have spent a fair number of years reading about Warren Buffett, Charlie Munger, Philip Fisher and a few other investors known for their track record in investing. Two of the main reasons I like these names are:
- They were not fed with a golden spoon: they started average or above average but not millionaires.
- They are consistent: their methods work for the very lo...
Berkshire Hathaway and IBM
I have always been long Warren Buffett and Charlie Munger. I respect all the work they have done and the basis of this work, the virtues they carry and the unmatched persistence on top of all of that. They invest and they invest big when the price tag is right; this is the philosophy I'm carrying and implementing for my stock market investments, one that I deem fundamental to how I invest money...
Google Code Jam 2015
Another year of Google Code Jam and interesting problems as always. I love how the problems end up looking simple at the end of each round.
The first problem was relatively easier than the rest.
Your friend is an opera singer and you want to show her support by making sure everybody claps when she is done. This is determined by each person's level of sh...
Wealth growth over 50 years
How much would you accumulate if you earn 20% off your capital annually? That's $20,000 if you start with $100,000. Not so bad.
Now, think of maintaining this over 50 years. The results are just mouthwatering:
It's exponential. That's around $619,000 in 10 years, $3,830,000 in 20 years, $23,730,000 in 30 years, $147,000,000 in 40 years, and a staggering $910,000,000 in 50 ...
History of United States Recessions
Looking back at the last 100 years or so, one can notice a pattern in the economic recessions that's been happening over and over again.
Time since previous recession (months)
1 year 9 months
Recession of 1937–1938
4 years 2 months
Public vs private sector
Having worked for around 4 years in the private sector, it was nothing short of a delightful experience. I have accelerated my learning curve, accomplished interesting projects and got to see how politics (at all different scales) move things around.
Things move fast, demands keeps increasing, you are expected to deliver on time with the same 8 hours a day and a doubled up load yea...
Chain of random thoughts; read at your own risk!
What's the difference between a computer and a human?
Emotions. Consciousness and emotions?
Intelligence is ever increasing, intelligence of computers - although derived by humans - could greatly exceed that of humans.
Emotions on the other hand do not exist.
"I'm hungry" said by a fat man with a grin on his face is way different th...
Google Code Jam 2014
I have participated in this year's competition of
Google Code Jam. Being my first time in an online competition ever, it was pretty interesting, and tough!
The competition was as high as you can imagine, with people from all the different countries in the world, solving problems in minutes, problems that I would need at least an hour to solve. After getting disqualified today, I ha...
Tunneling ports through SSH
One of the annoying things if you are behind a strict firewall is finding out certain ports are blocked to your server and you would need to stop everything you are doing until this is resolved. This is very common in corporates.
A useful and effective approach to this problem is using SSH to tunnel any port through an established SSH connection, it doesn't require you to enable these ports on y...
Setting up Django + uWSGI + Nginx for production
- Django 1.5, 1.6
- uWSGI 1.9.x
- Nginx 1.1.x
- Supervisor 3.x
Here is my setup for a production Ubuntu server running Nginx as a web server and uWSGI to wrap my Django project and execute python code.
You need to place your project somewhere, usually I create an OS user for my project and create a virtual environment in there....
Django Project Structure
After a couple of years of messing around with Django, I have settled with this project structure that I find to be verbose enough to remind me where everything is:
│ ├── blog
│ ├── core
│ ├── apps
│ │ ├── blog
│ │ ├── core
│ │ └── pages
│ └── libs
│ ├── bootstrap
│ │ ├── css
│ │ ├── fonts
│ │ ...
Getting descendants of a model instance in Django
For this website, I have a model called Category defined as follows:
name = models.CharField(max_length=64)
parent = models.ForeignKey('self', null=True, blank=True)
I wanted at some point to retrieve all the descendats of a certain category, unfortunately Django ORM doesn't have this feature out of the box (yet), so I had to create my own. The idea is cr...
Extracting key-value pairs using XQuery
I have written a function in XQuery where you can pass a key as an argument and retrieve that key's value, this function can be applied on unformatted text.
I have defined separators (of pairs) as a regular expression pattern that would match all whitespace in addition to commas:
And then I applied another regular expression to extract the key and value parts out of each pa...
Testing a post with a WYSIWYG editor.