- eslint-utils>1.4.1 was a critical pin fix. Dependabot submitted PRs for both.
- David Blaine gave a tech talk on how to hold your breath for longer:
- Hyperventilate beforehand (breath in and out very quickly). This purges your body of CO2.
- Full breath in. Don’t let any out.
- Don’t move at all. Even eyes. Every movement uses oxygen.
- Larger lung capacity is a natural advantage.
- Be in shape. The lower your resting heart rate, the more efficient your oxygen will be.
- Be lighter. The less pounds you carry, the less oxygen you need.
- If you breathe pure O2 (artificially) beforehand, you can hold a lot longer as well.
- During an extreme breathholding attempt, your BPM can drop to ~10. Holyyyyy cow.
- Financial research:
- Feds typically try to keep inflation at about 2% year over year for economic stability. This is a good number to keep in mind for annual raises.
- We are currently in a very long bull market, about 2009-2019. The common definition for a bull market is a 20% swing. So if S&P500 for example hits a low of $1000, then eventually rises to 1200, the bull market will be the time period from that rise until it falls to 1000 again. But it’s flexible, bull markets are just general upward trends. There was a long bull market from 1982-2000 (dotcom through y2k). Bear markets are the opposite. These are stupid names. The bull tends to attack upwards whereas the bear swipes downwards.
- Insider sales (executives of big companies selling stock) are often good signs of a swing towards bear. This has been increasing a ton lately (aug saw over 10b sales).
- Yield curve inversion is a comparison of 2yr vs 10yr treasury notes. The longterm note should yield higher interest in a good market, obviously. When it inverts and the 2yr note yields higher interest, it usually means a decline is on its way. The late 20XX recession hit about 2 years after the inversion. Right now, the 2yr is at 1.526% and the 10yr is at 1.479%. The metric here is -4.7 basis points, which is the hundredth-of-percentile difference. This is a really bad inversion.
- The ongoing china trade struggles, tariffs, and presidential tweets are also causing some economic risk.
- All factors above considered, we’re very likely headed for bear. Timing is the golden ticket now.
- During recessions, invest in bigger companies. Less risk. Small companies and companies with debt usually do not survive.
- Treasury bonds are one of the safest places to put money before/during a recession. You’re effectively loaning the government money and you get paid the interest. This loan is part of the national debt! You can’t just buy bonds like shares on the public market, you bid for them.
- Gameplan, I guess: sell some of my smaller holdings and finish the tax burden. If any leftover: bonds or low risk low return big companies.
- Digital ocean sent me an email that they had detected an unsecured mongo instance on my droplet. This is such a cool service – I love it.
- Mongo starts up by default without auth. Any user on the local system can create/delete/read/write. This is how the blog component of my bmahlstedt.com site was set up.
- I would shell into the database (which persists over a docker volume) and add the admin user. Then add a conf file with the creds (gitignore) just like supercontest, and use it within the backend app’s docker composition so that it could authenticate when it tries to communicate with the db container. Then you enable auth in the mongo system conf file. https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-mongodb-on-ubuntu-16-04. I chose not to do this, because I don’t use the blog.
- A research elephant was given 297mg (that’s like 3000 doses) of acid in 1962: https://www.theguardian.com/science/2004/feb/26/research.science.
- Five square puzzle, programmatic solution. http://thinkingames.com/WorkPages/ProductSingle.aspx?pID=5.
- Always check the simple brute force first.
- There are 5^25 permutations of the grid if you ignore rotation and piece constraints. That’s 298 quadrillion possibilities, which is way too much to brute force. Even if each grid took 1 microsecond to check, the whole state space would take 1000 years to verify.
- What about if we approach it with the piece-placing route?
- Each 1×2 piece has 20 positions while vertical and 20 positions while horizontal. Then if you count for flipping while in each position, that’s 80 positions total. Each 1×3 piece has 15 positions while vertical and 15 positions while horizontal. Then if you count for flipping while in each position, that’s 60 positions total.
- There are two 1×2 pieces and seven 1×3 pieces, so we have 80^2*60^7 = 1.79e16. This is 18 quadrillion instead of 298. We’re getting a little closer.
- In reality, there are many fewer because as each piece is placed, it increasingly constrains the available positions of the remaining pieces.
- Sounds like we should do a recursive piece-placing strategy, failing fast if any configuration fails?
- Ok but first, ignore the symbols. Let’s simply check the permutations for shape placement. Once we have this number N, we can probably brute force. For each shape-constrained grid, we’ll have 14*12*10*8*6*4*2*4*2 options, or 5,160,000. The number N shouldn’t be too high, there are only so many ways to organize items of length 3 in a 5×5 grid.
- Well let’s look at an anchoring strategy for the recursion. This will constrain it even further. No matter the state of the grid, every piece can be considered to have an anchor: its upper-left-most cell. So every grid has 9 anchors. From each anchor, there are only 4 options: 3×1 horizontally, 3×1 vertically, 2×1 horizontally, 2×1 vertically. So we can iterate through each of these permutations, 4^9 = 262,000. Starting in the upper left origin, walk all of these paths with 4 branches at each anchor. This should yield 4x duplicate solutions as well for 90deg rotations, so we expect ~65,000 total iterations to find N from above, N, being a much smaller number because a small percentage of the anchor permutations fit all 9 pieces on the grid.
- There ended up being 164 permutations of shape placements, counting all rotations, which means that N = 41.
- The first attempt at part 2, recursively placing all permutations of the 9 pieces for 5,160,000 options without fail-fast, railed my i5 at 100% cpu for 4 minutes, growing the stack to about 85% of my 4GB of RAM then using the majority of 8GB swap as well. The calculation was not done after 20min, for a single grid of the N=41, so I killed it and proceeded with the validity check after each placement.
- Properly failing fast on part two’s recursion yields 32 solutions in ~16s on my i5. This is from N = 164, so we haven’t respected rotation yet. The stack is negligible in mem. Once all 32 solutions are known, we could write a programmatic deduplication of the rotation/mirror equivalents, but 32 is small enough to do by hand.
- Solved:
- Put all code in https://github.com/brianmahlstedt/fivesquared.
- Trading bot:
- Created new github repo for this app.
- Wrote my own robinhood api wrapper for transactions, stripped mostly from jamonek. I don’t trust third-party code with my financial keys.
- Used yahoo_fin for the inputs. Confirmed they offer live pricing now.
- In py>=3.4, the reload built-in has moved to importlib.reload(). Use `from importlib import reload` then stay the course.
- “Patience is not the ability to wait – it’s how we behave while we’re waiting.” – Joyce Meyer
- If your flow requires break/continue to various layers of loops (more than 1 away), then you need to refactor into functions.