Installing Zipline on Colab

If you’re using Zipline for portfolio analysis you may be wondering how to get it installed in Google Colab which is running Ubuntu 18.04. Here are the commands.

!wget https://launchpad.net/~mario-mariomedina/+archive/ubuntu/talib/+files/libta-lib0_0.4.0-oneiric1_amd64.deb -qO libta.deb
!wget https://launchpad.net/~mario-mariomedina/+archive/ubuntu/talib/+files/ta-lib0-dev_0.4.0-oneiric1_amd64.deb -qO ta.deb
!dpkg -i libta.deb ta.deb
!pip install ta-lib
import talib
!pip install zipline-reloaded
!pip install pyfolio

%env QUANDL_API_KEY=<your key>
!zipline ingest -b quandl

We need solar to diversify our energy imports away from countries like Russia so let’s choose our SRP leaders wisely

This week has been an emotional one. We welcomed our new baby, Olivia, to the world on 3/1/22. It’s hard to not be extremely grateful, emotional, and realize how lucky we are when we see what is happening in Ukraine. Babies are being born in bomb shelters and thousands are evacuating Ukraine as I write this. I cannot fathom what it would be like to have our baby in a situation like what is occurring in Ukraine. We need to build a country that is not reliant on corporations and oil imports for the future sustainability of our country.

America has a problem with oil

America has a major issue regarding how much oil we import. In 2020 we imported 7.86 million barrels of oil. Think for a minute of all the major oil-exporting countries. How many of them do you believe are friendly to the United States?

Oil exporting countries

  1. Saudi Arabia: US$113.7 billion (17.2% of exported crude oil)
  2. Russia: $72.6 billion (11%)
  3. Iraq: $50.8 billion (7.7%)
  4. United States: $50.3 billion (7.6%)
  5. United Arab Emirates: $47.9 billion (7.2%)
  6. Canada: $47.6 billion (7.2%)
  7. Kuwait: $28.3 billion (4.3%)
  8. Nigeria: $25.2 billion (3.8%)
  9. Kazakhstan: $23.7 billion (3.6%)
  10. Norway: $22.7 billion (3.4%)
  11. Angola: $20.2 billion (3.1%)
  12. Brazil: $19.6 billion (3%)
  13. United Kingdom: $16.1 billion (2.4%)
  14. Oman: $15 billion (2.3%)
  15. Mexico: $14.9 billion (2.2%)

Let’s start with Saudia Arabia. In 2018 they decided they would lure Jamal Khashoggi, a journalist for the Washington Post, into an Istanbul consulate and chop him to pieces. The most protected form of free speech should be given to our journalists.

The second on the list is Russia as we speak they are invading Ukraine. Killing and destroying everything in their way. The list of issues goes on…

Oil, energy, and SRP

Let’s get to what all this has to do with our future and the future for our children. There is only one way for the United States to diversify away from our oil imports, electric cars and solar. While solar and electric cars are not perfect they are the best chance we have at diversifying away from our oil imports and reliance on nations not friendly to our country. Note that I said diversify, not eliminate. I don’t think that’s rational as there are necessary use cases for oil that will always exist.

In order for solar to be sustainable, we need something called “net metering” essentially what this means is if you install solar on your house and overproduce electricity on a net annual basis you should only be charged for the net energy that you use (consumption – production). Unfortunately under the current leadership of David Rousseau and John Hoopes, and other corporate cronies this is not happening. They tout on their expensive mailer that they are solar-friendly and their opponents are bought by special interest groups. But one only has to look as far as the amount of money they are spending on their campaigns to know that they are backed by institutional donations. As America forges ahead with the democratization of electricity through rooftop solar installations they are exactly the type of politicians that get in the way. They push for centralized solar like the large-scale solar farms you see in the desert. These installations, while great for the environment, take all the financial benefit for the consumer and only benefit the corporations installing them.

I have 20kw of solar installed on my house. This provides about 100% of my electricity usage a year. Last year we installed solar on my parent’s house. Based on the current SRP plans and not recognizing net metering it kills the ROI for the average homeowner.

Trust Fund Kids and antiquated elections

SRP elections are antiquated and regressive. The more land you own the more votes you get. Yes, you read that right. The more land you own your elite vote suppresses all of the commoners. So if you visit the website of the existing SRP members you’ll see endorsements from trust fund kids who have inherited their money and political positions largely due to family inheritance and their religious connections. That is what allows these people to stay in power.

So as these two corporate shills would say “Keep your eye out” for your ballot this year. But be careful as there is more than meets the eye in the deception of their mailer. Let’s vote for a future for our kids. A future where electricity is decentralized and affordable through solar. Vote for the SRP Clean Energy team.

How to get a ballot

You will not receive a ballot even if you are a registered early voter. SRP has its own early ballot list. You can request one, here.

Important Dates

Wednesday, March 9th early ballots

Friday, March 25th last day to request early ballots

Tuesday, April 5th Election Day

Saving your Audible books to MP3 using Python, Colab, and AAXtoMP3

If you’re like me and you don’t like having your audiobooks tied up in Audible. There is a way to convert them to MP3.

I wrote some Python code in Google Colab to show this process.

The first thing you’ll want to do is mount Google drive so you have access to your files. This can be done here.

Your working_folder is the location in your Google drive that the files will be backed up to.

working_folder = 'Books/audible_backup'

# <----- Make sure to mount drive in Colab first 
import os
import sys
if 'google.colab' in str(get_ipython()):
  print('Running on CoLab')
  root_dir='/content/drive/My Drive/' + working_folder
  if os.path.isdir(root_dir):
    %cd $root_dir
  else:
    print('Check your working_folder or if Google drive is mounted')
    sys.exit()
  sys.path.append(root_dir)  
  print('Colab code has been executed')
else:
  print('Not running on Colab')

Here is my Google Drive mounted in Windows for comparison

Install the dependencies

!apt-get update
!apt-get install ffmpeg libav-tools x264 x265 bc
!apt-get install mediainfo
!pip install audible
!pip install audible-cli
!pip install ffmpeg
!apt-get install mp4v2-utils
!apt-get install jq
!apt-get install bc

!add-apt-repository ppa:savoury1/ffmpeg4
!apt-get update
!apt-get install ffmpeg
!ffmpeg -version
!apt-get install mp4v2-utils
import os

Run audible-quickstart to attach your Audible account.

!audible-quickstart

Now we’re going to make a backup of all of your audiobooks in AAX and AAXC format.

%cd /content/drive/My Drive/Books/audible_backup
!audible download --all --aax --cover --cover-size 1215 --chapter
!audible download --all --aaxc --cover --cover-size 1215 --chapter

Once you clone all your books to AAX and AAXC files in Google Drive it should look like this.

Now we need your AUTHCODE for your AAX files.

AUTHKEY = !audible activation-bytes
AUTHKEY = AUTHKEY[0]
print(AUTHKEY)

Next, we’ll clone a tool from Github called AAXtoMP3 and make sure it has executable permissions. This tool does all the heavy lifting.

%cd /root
!git clone https://github.com/KrumpetPirate/AAXtoMP3.git
%cd /root/AAXtoMP3
!chmod u+x /root/AAXtoMP3/interactiveAAXtoMP3
!chmod u+x /root/AAXtoMP3/AAXtoMP3

Now that you’ve cloned AAXtoMP3 you can run the following code:

%cd '/content/drive/My Drive/Books/audible_backup'
for filename in os.listdir('/content/drive/My Drive/Books/audible_backup'):
  if filename.endswith('.aaxc'):
    print(filename)
    os.system(f'/root/AAXtoMP3/AAXtoMP3 -e:mp3 --level 4 -c -l 1 -n {filename}')
  if filename.endswith('.aax'):
    print(filename)
    os.system(f'/root/AAXtoMP3/AAXtoMP3 -e:mp3 --level 4 -c -A {AUTHKEY} -l 1 {filename}')

Open In Colab

Lords of Easy Money and Thomas Hoenig

The FED’s decisions affect every asset you own all the way down to the cost of your everyday grocery purchases. I highly recommend Lords of Easy Money by Christoper Leonard. I would also recommend reading and listening to Thomas M. Hoenig’s positions on the FED policy. He served as the President of the Federal Reserve Bank of Kansas City from 1991 to 2011. This book dives into Thomas Hoenig’s dissenting votes on the FOMC and confirms that the current FED policy is a radical experiment in monetary policy. It has increased wealth inequality by driving up asset prices. Meaning, the people who own assets are getting much wealthier and those who don’t are becoming poorer. It also speaks on the current inflation that we are seeing all around us. There is no easy path out of our current situation.