Skip to content

Instantly share code, notes, and snippets.

# Free books by Springer with categories
Thanks to Springer for making these available.
See announcement:
https://www.springernature.com/gp/librarians/news-events/all-news-articles/industry-news-initiatives/free-access-to-textbooks-for-institutions-affected-by-coronaviru/17855960
Thanks to Harish Narayanan for the categories.
See announcement:
https://hnarayanan.github.io/springer-books/
@mauler
mauler / http_server_auth.py
Last active August 9, 2024 13:54 — forked from fxsjy/SimpleAuthServer.py
Python3 http.server supporting basic HTTP Auth (username/password)
# Extended python -m http.serve with --username and --password parameters for
# basic auth, based on https://gist.github.com/fxsjy/5465353
from functools import partial
from http.server import SimpleHTTPRequestHandler, test
import base64
import os
class AuthHTTPRequestHandler(SimpleHTTPRequestHandler):
@nocd5
nocd5 / tabline-dnd.patch
Last active May 6, 2016 11:05
D&D tab reordering 7.4.709 compliance
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 97ad6b0..e03295c 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -2946,6 +2946,29 @@ on_select_tab(
}
/*
+ * Handle reordering the tabs (using D&D).
+ */
Buffett bought PetroChina from 2002 to 2003. The first time we see PetroChina shows up is in 2003 annual letter.
source: http://www.berkshirehathaway.com/letters/2003ltr.pdf
From the letter we know that Buffett paid $488 million dollars for 1.3% of PetroChina. We didn't see any discussion on this position until Buffett talked about its sale at 2007 letter. Buffett did something unusual, he gave us a glimpse of his valuation for PetroChina.
Source: http://www.berkshirehathaway.com/letters/2007ltr.pdf
Let's calculate the average price Buffett paid:
according to PetroChina's 2004 annual report: http://www.petrochina.com.cn/resource/EngPdf/2004ndyj_eng.pdf
There are 175.82 billion shares outstanding. 1.3% of that is 2,285,660,000 shares. Buffett probably bought the ADR (ticker PTR trading in US). One ADR = 100 HK share, so he paid $488 million for about 22.8566 million shares of PTR, or $21.35 per share.
Back then, Buffett and Charlie valued PetroChina's intrinsic value at $100 billion, or about $56.88 per sha
@leipzig
leipzig / mycd.sh
Created January 21, 2012 03:36
directory based history bash profile
function mycd()
{
#if this directory is writable then write to directory-based history file
#otherwise write history in the usual home-based history file
tmpDir=$PWD
echo "#"`date '+%s'` >> $HISTFILE
echo $USER' has exited '$PWD' for '$@ >> $HISTFILE
builtin cd "$@" # do actual cd
if [ -w $PWD ]; then export HISTFILE="$PWD/.dir_bash_history"; touch $HISTFILE; chmod --silent 777 $HISTFILE;
else export HISTFILE="$HOME/.bash_history";