• Retract your bed into the ceiling: https://www.bumblebeespaces.com/.
    • The jinja templates have access to the entire g object by default, you don’t explicitly need to pass it or its attributes.
    • Bootstrap.
      • Bootstrap source classes: https://github.com/twbs/bootstrap/blob/master/dist/css/bootstrap-utilities.css (and an analogous file for grid, etc).
      • center-block -> mx-auto.
      • Great comment on centering options in bootstrap 4: https://stackoverflow.com/a/42559095.
      • If you go more than 12 cols, it wraps. There are a few other ways to get around this: nested grids and scrolling.
      • “responsive” is such that it updates as your viewport size changes (changing from fullscreen to half, etc). You can specifically use these responsive classes on components like tables, and there are analogs for items like containers (container-fluid).
    • Supercontest.
      • Fixed the g usage, no longer passing it back to the templating engine. All of the views are 1000x cleaner no. Passing request.url_rule.endpoint for the inferred self blueprint string (like url_for(‘week.week_picks’)) instead of week_link_prefix or switch_link.
      • week existed in the url_defaults dict as a key, but was undefined when coming from the lb view, so it didn’t look up the max. Changed that to infer the max when either nonexistent OR undefined.
      • Restyled EVERYTHING. Removed a lot of my custom css in favor of the bs alternatives.
      • A lot of inconsistency was from my usage of bootstrap 4 syntax but with bootstrap 3 compiled css/js in my project vcs. Upgraded, and swapped to cdn usage of bootstrap and notify. Bootstrap requires jquery and popper.
      • Added jumbotron for ads at the top.
      • Made the syncing nice between ‘active’ class state for the navlinks. Js basically checks the url and infers what page it’s on.
      • col-auto for variable width based on content. Changed the name/email nav item to this, in case a name or email is very long. Don’t want it to span two lines.
      • Renamed the / endpoint to /matchups explicitly. This made the url inference easier to match to the tag ids for active class states.
      • no-gutters on the row didn’t do exactly what I wanted for the week navs. I nested the grids in a container-fluid for 100% width, then manually set px-0 on the inner cols. Both inner and outer cols had text-center, and both inner and outer rows had justify-content-center. Looks perf now, for all breakpoints.
      • Converted the tables to bootstrap. They basically had everything I had written custom in css. So much cleaner.
    • In chrome devtools, when inspecting elements, on the css tab: if a property is crossed out, it means that something more specific or something downstream overrode it.
    • Some chargers have a UV bath for sanitizing your phone: https://www.amazon.com/PhoneSoap-Sanitizer-Universal-Patented-Clinically/dp/B072R6MJKQ.
    • In Python, you can unpack (destructure) strings as an iterable just like a list!
    • Should probably hook my public github apps into travisci at some point.
    • Talked with the spacex folks a little bit about investing. Many hold philip morris, which is bullshit, but we talked about recession strategies as well. Some are putting into fixed rate savings accounts @2.5%, which I guarantee I can beat on the public market. My portfolio grew during 07-09. Companies like Netflix, Amazon, Groupon, Lego, and many more all saw between 20-80% annual growth during the last bear.
    • APR is a little different, it’s the charge.
    • The rule of 72: timeToDouble= 72/interestRate So if you want to double your money in ten years, you need to find an annual interest rate of 7.2%.
    • two-movies.name is a good alternative for stuff like yesmovies, watchseries, movie4k, etc.
    • Vegas odds has the 2019-2020 nba champs at clippers (3.5) lakers (4) bucks (6) rockets (8) 76ers (8) warriors (12).
    • Placed fresh order. Trying a ton of new vegetables to juice like radicchio, green cabbage (usually do red), and golden beets (usually do red).
    • The Jamie from JRE is Jamie Vernon: http://www.youngjamie.com/. He’s a producer/photographer/gamer. His website isn’t encrypted lol.
    • Started using google calendar more deliberately. Wanted to avoid conflicts like the blake st trip.
      • Uninstalled ticktick, no longer need a todo list. Calendar has tasks and I want to keep it all in the same place.
    • SpaceX FF draft.
    • Bottled kombucha for second fermentation with blueberries. Made new batch.
    • Supercontest.
      • Talked logistics with petty for a little bit. Gave the creds to the account.
      • Created another ticket with some cleanup: https://github.com/brianmahlstedt/supercontest/issues/35.
      • Made the sc container names unique to not conflict with bmahlstedt.com.
      • Docker system prune (not volumes), reclaiming 13GB lol.
      • The password had been wiped on the supercontest db in my local persistent volume. Alter user to fix it, back to what it was before.
      • Jinja’s |safe filter is what you use to disable all autoescaping. This allows you to do things like pass raw html via python strings to the renderer (similar to a jsx fashion, having html in the app), rather than relying on the template to contain all of the html.
      • Removed the week shim, the / home route will run the url_defaults to set the week at the max available.
      • Restricted it so that other users’ picks for the current week are hidden until midnight on saturday.
      • Made the leaderboard, graph, and navbar show first name and last name instead of email. If names aren’t present, it defaults back to email.
      • Customized the flask-user templates for various things like registration and login. Removed my main/profile and replaced it with the standard user/edit_user_profile. It was just naivete when I first built the app.
      • Centered everything, including the feedback route. Styled them all much better and much more consistent. There was a lot of shitty styling, and still is. I’ve moved bits and pieces over to the proper bootstrap implementation, but there’s still a lot of conflict between custom classes and styles.
      • Closed https://github.com/brianmahlstedt/supercontest/issues/35.
    • Slight bootstrap refresher, since enough time usually passes between UI projects to forget syntax.
      • form-group for inputs with other tags. form-control for styling.
      • container, row, and col. You can align and justify within. 12 columns. Assign width however you want, and it can be different across different screen sizes. Comes with natural gutters, 15px on each side of each column. You can lay out forms in rows/cols in the same way.
      • text-center. <abbr> for hover. <pre> and <code> for code. Variables. User input. nav, navbar (dropdown), jumbotron.
      • clearfix should be added to the parent div around floating elements, like float-right or left.
      • Pagination, popovers, progress bars, spinners, shadows.
      • Width w height h padding p margin m. Margin can go negative (padding can’t), so you could have something like mr-lg-n2 which would mean negative right margin on large viewports.
      • Screen size callouts apply to that and anything larger. sm > 576px, md > 768px, lg > 992px, xl > 1200px.
        • 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.
              • You have 3 natural cortisol peaks throughout the day, 8-9, 12-1, and 5-6 (approximately). While cortisol is normal regarded as the bad stress hormone, this is only after long-term stress effects. Short-term, cortisol can be regarded as the body’s natural upper to increase alertness. Drinking caffeine while the body is already peaking cortisol is not efficient, because then your body starts relying on the external caffeine and reduces internal cortisol production. This is more detrimental than you’d expect – it both REDUCES your natural energy levels and makes you more tolerant of caffeine for external stim. You want to drink caffeine during the cortisol valleys, mid-morning and mid-afternoon. This is like any other drug – take it when you need it, not when the symptoms are absent.
              • Smoked a curry pork butt today.
              • LD50 is the dose which would be lethal for 50% of people.
              • Tons of markets suffered (toys, cars, etc) at the end of last week due to trade wars with China, tariffs, Trump tweets to pull production from China, etc.
              • Yes, the gelatin in jello and candy is the same gelatin from rendered animal collagen.
              • The yahoo_fin module shows that the live stock prices change on the order of magnitude: seconds. It’s not consistent. Sometimes it’s one second. Sometimes it’s 15 seconds.
              • James Randi had a show called exploring psychic powers where he made fools of people who claimed to be psychics: https://www.youtube.com/watch?v=ldr2JTuHBy0.
              • Finance research.
                • Joined 3 subreddits: r/investing, r/personalfinance, and r/tax.
                • SpaceX should be shielded from gigantic market dip, because fundamentally our product has nothing to do with China, and because we’re a private company, but unfortunately that’s not how the market works. Our valuations will see a decrease from this. I attribute it mainly to how misguided the concept of investment has become. People are not investing because they believe in things, adding value to products they support; they invest as a moneymaking opportunity. They invest for personal financial growth. This lumps the market into a singularity, a big pool representing fluctuating waves of chances, not orthogonal markets representing their respective contributions to society. If investors actually placed money based on virtue, each corner could roller coaster in isolation from the others.
                • ETF = exchange traded fund. These are collections of other assets that are grouped to track an index, like the S&P500 ETF does for S&P500.
              • “Link in bio” on instagram is annoying af. Just give me the link, don’t shamelessly take 4 seconds to self-promote. You’re intentionally injecting the equivalent of an ad between the customer and their desired content, causing a bad taste in their mouth before consumption. Not smart.
              • New Chappelle standup on Netflix.
              • googlefinance used to be a maintained python wrapper for realtime stock data, but no longer. Yahoo-finance used to be 15min delayed, so it was a lesser option, but now it appears that it offers live prices and is maintained. I’ll use yahoo-fin for my bot.
              • Joe silva was the longtime matchmaker for the ufc, but now the role is filled by Sean Shelby and Mick Maynard. They’re the #2 decisionmakers after Dana.
              • Went to an IT-chapter2 themed haunted house last night to promo the upcoming movie. Was awesome.
              • Also saw Ready or Not, which was surprisingly good. I had no idea it was half comedy.
              • Chipotles, by definition, are just smoked jalepenos. I’ll try some with the pork butt tomorrow. They only need to be on for an hour or so.
              • Went to Smorgasburg for BBQ day. Finally had Moos. Was very good.
              • Andrew luck retired, shocking everyone.
              • My amazon visa was declined the past couple times. They didn’t have online support, so I called. They card had expired, and they had not sent a replacement. The agent said that was weird – the automated system should have done so already. Got a new one on the way.
              • Went to Smorgasburg for the first time. The “row” in the arts district is pretty nice, but the neighboring smorgasburg sector is kinda dumpy. It’s a distribution center that has worn forklifts and homeless clutter. They fill it with food stands every sunday and it becomes a nice little food court.
              • Moos was there. Overall grade: B+. Satisfied, overall. A- for the actual grade in pitmaster quality, but marked down for the ludicrous prices.
                • A. Brisket was very good. Got point only. burnt ends were tasty, good seasoning level. Very tender. Franklins remains untouched, but this comes in shortly after. Light on smoke flavor (i prefer heavy), but light on seasoning (i prefer light) and fantastic on moisture. This is better than my homemade brisket.
                • B-. Spare ribs. Decent. Was wrapped too early, because the bark formation was minimal. Not seasoned much at all. My ribs are better.
                • C+. Beef ribs. Ok. This cut is hard to screw up because it’s so fatty, so the flavor can’t really be missed, but the tenderness was average. Doesn’t come close to my homemade honey/maple short ribs. I would have given this a B+, but the price was asinine. They charge $56/lb for the regular beef ribs, and $60/lb for the pastrami beef ribs. Absolutely-fuggin-ridiculous. You can get raw short rib, from the plate, prime grade, for $7/lb from a decent distributor.
                • Went through MD/HN.
                • Read a bit of Vue’s docs, for comparison to React.
                  • vue init webpack <myproj> is like create-react-app
                  • Still use components, and they update as the underlying data changes, but you do so with classic html/css/js rather than jsx (html in js). You CAN combine these all into a single .vue file with meta js/css/html.
                  • You get a few useful html classes like v-for v-if v-bind v-on which allow you to conditionally/customizably display data and/or events.
                • Next.js is the framework for full node/react apps (as opposed to create-react-app for simple single-page apps).
                • Daytrading is … just transacting throughout the day on small fluctuations, rather than long-term.
                • Shorting, You do this when you think something is overvalued or you expect it to drop.
                  • Selling shares that you do not own with the obligation to buy them back later.
                  • Say I short company A. I go to a broker and “sell” 10 shares for $100 each. I then have $1000 and the requirement to “buy” the shares back at some later date.
                  • This is like the opposite of a regular transaction, where you buy and hope it increases.
                  • If the price drops, as I expected, to something like $80 then when I “buy” all 10, I will have effectively bought at 80 and sold at 100, making a profit of $20 per share.
                  • If the price INCREASES, then you are losing money. If it goes to $150, you’ve lost $50 on each share.
                  • There is an important difference with this method. Shorting stocks can theoretically lose you an infinite amount of money. With a regular stock purchase, say for $30, you can only lose that $30. If you short a $30 stock, like an early google share, and it rises to $1000, you’ve lost $970, and will continue to lose more as the price increases.
                • Good documentary about dana white and the fertitta brothers: https://www.youtube.com/watch?v=tWMG1PsR21U. TUF saved the early days of the UFC!
                  • Lot of respect for these guys building a product that THEY supported. Decisions were not solely made for finance or for business, they were made for the furtherment of the sport. These 3 men believed MMA should be up there with NFL/NBA/MLB/NHL, so they sole intent of the UFC was the exposure of that to the fans.
                  • WME bought the UFC for 4 billion recently. They also own zuffa, miss universe, and more. WME stands for WIlliam Morris Endeavor, but the company is simply known as Endeavor now.
                  • Here are the rankings for sports agencies from 2018: https://www.forbes.com/sports-agencies/list.
                • Bobbing a bike is making it naked and removing the passenger assemblies so it ends at the seat (like a bobtail). I won’t remove the tail of the bmw so that I can still use the saddlebags.
                • Breakfast at Hangar with the softball crew.
                • Change it to ceddit in the url to see the mod-removed comments, etc.
                • The reason you have to import react in seemingly unnecessary places is usually due to jsx.
                • Dockerfiles can have multiple RUN instructions to build the image, but only one CMD or ENTRYPOINT. This is what is run to start the image.
                • Docker rework for bmahlstedt.com.
                  • Standardized the docker compose file with separate services (and dockerfiles, where necessary) for dev and prod.
                  • Got it proxied by the nginx container, with routing by domain), and certified by the letsencrypt container (super simple with current umbrella docker-compose infra).
                  • The frontend in production is actually pretty easy. You just run npm build in an intermediate container then point nginx at the static files in a second container (the docker name for this is multistage build). The output of ./build/ goes into /usr/share/nginx/html.
                    • Remember, the output of this build looks hardly like the source js you wrote. It bundles and minifies quite a bit for the optimized production build.
                    • Another kinda weird thing – you still use jwilder/nginx-proxy to route the initial requests to the proper domain. This goes to a flask app with uwsgi on the supercontest app, but for bmahlstedt.com, it goes from the nginx reverse proxy container to another nginx container serving the npm build output. This is not superfluous, something needs to serve the static files. There’s another container running pm2/node for the backend, obviously – this just makes more sense because it’s nginx->pm2 instead of nginx->nginx.
                  • Instead of starting the app with `node` I start it with `pm2` the node process manager. This allows you to start/stop/monitor and more.
                  • The only increase in complexity is because of react-router, which you have to make dynamic. To do this, you simply overwrite the default nginx.conf to include root and index.
                  • The other
                  • Deployed to production. Closed ticket #9.
                • Cool CDN to get SVGs for common brands: https://github.com/simple-icons/simple-icons.