Half and Half vs Milk

Fat content:

Half and Half:

10.5% to 18%
Whole milk:

3.25%
Reduced fat milk:

2%
Semi-skim milk:

1.8%
Low fat milk:

1%
Skim milk:

0.0 to 0.5%

What is half and half? It is a simple blend of equal parts of whole milk and light cream. So milk and cream.

ref:
http://www.howstuffcompares.com/doc/h/half-and-half-vs-milk.htm
https://www.thekitchn.com/what-is-halfandhalf-ingredient-intelligence-205959
https://en.wikipedia.org/wiki/Cream

Unicode encodings in python

So “str” in Python 2 is now called “bytes,” and “unicode” in Python 2 is now called “str”.

Oh boy, that’s why I have been so confused working on both Py2 and Py3 on various projects.

It’s year 2020. From this point on, it’s all Py3. So I/O is all byte string, and try to keep unicode/str inside python. IO_byte_string.decode() -> unicode_string, unicode_string.encode() -> IO_byte_string. So:

with open(filename, 'rb') as f:
  byte_string = f.read()  # binary
  # external knowledge: data encoded in utf-8
  my_string = byte_string.decode('utf-8')
  # my_string is a list of "code points"
  # Output say, using 8859-1 (Latin-1)
  output_byte_string = my_string.encode('8859-1')

OR

# external knowledge: data encoded in utf-8
with open(filename, 'r', encoding='utf-8') as f:
  my_string = f.read()  # code points

# Output say, using 8859-1 (Latin-1)
with open(filename2, 'r', encoding='8859-1') as f:
  f.write(my_string)

ref:
https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/
https://nedbatchelder.com/text/unipain.html

Python strings

I started out with “+”, then was told not to use it. So I listened and used “join”. Then later I used format. Now it seems that I should use “f”.

f'{s} {t}'               # 78.2 ns
s + '  ' + t             # 104 ns
' '.join((s, t))         # 135 ns
'%s %s' % (s, t)         # 188 ns
'{} {}'.format(s, t)     # 283 ns
Template('$s $t').substitute(s=s, t=t)  # 898 ns

ref:
https://martinheinz.dev/blog/13
https://twitter.com/raymondh/status/1205969258800275456

No title

Good read: https://tjcx.me/posts/i-wasted-40k-on-a-fantastic-startup-idea/

Make something people want. It’s Y-Combinator’s motto and a maxim of aspiring internet entrepreneurs. The idea is that if you build something truly awesome, you’ll figure out a way to make some money off of it.

So I built something people wanted. Consumers wanted it, doctors wanted it, I wanted it. Where did I go wrong?

“To succeed, an offering must create value for all entities involved in the exchange—target customers, the company, and its collaborators.”

Strategic Marketing Management

Gato Barbieri – Europa (Earth’s Cry Heaven’s Smile)

Download youtube videos

https://www.alltubedownload.net/

https://github.com/ytdl-org/youtube-dl

https://selfhostedsource.tech/self-hosted/p/alltube

Video Game Randomizers

It’s interesting how you can randomize some well-known retro games so you don’t always keep doing the same thing on the same old game. This brings new life to old school games. =) More amazingly I wonder how the code authors find out the parts in the rom to randomize. True geeks.

https://www.debigare.com/randomizers/