-
- Researched a pattern for automatic injection of season and week into all db calls. Flask’s g object already has season and week from my default value params, but I was hoping there would be a clean pattern where I didn’t have to pass them explicitly into every db call. There are some precompile event ways in sqlalchmey, and there’s a “BakedQuery” but none do exactly what I wanted. There’s no harm in being explicit in every query for now. Once the user table adopts season as well, I might be able to just have a wrapper around db.session.query which inserts season and week everywhere, but it’s not important for now. I was surprised a normative solution for this wasn’t more common/apparent.
- Sell orders completed in Robinhood. Transferred to BoA.
- Chiro. Feel much better.
- I don’t agree with this article: https://abe-winter.github.io/2019/09/03/orms-backwards.html. ORMs are of good convenience to the majority of users, like any high-level abstraction. Most database interactions of not of the complexity/difference that would require raw SQL for integrity.
- Blog.
- In the spirit of retention, I thought it would be a good idea to start a morning habit of rereading my previous blog posts. If I go back a week, this will take about 5 minutes. Every item will be ingrained 7 times, which should be enough to remember most details.
- Changed the main page to only show 7 days, so I just read the whole site every day.
- Redesigned. Simply black now. Better font sizes. Cleaner organization. Removed some gadgets.
- The pgadmin getting started docs are some of the worst I’ve ever seen. Very verbose, and none of the content I want. How do you install? Give me one sentence with options.
- The web interface allows you some conveniences. You can run the pgadmin server in a container and localhost:5050 gets a web application. You can create users, tables, modify data, etc.
- Any package that requires you to wget a wheel and install it manually is…not going to get any attention. Upload your modules to pypi like a normal human being pls.
- I’ve been satisfied with psql so far; I’m not going to use pgadmin because of these unnecessary deterrents. PSQL forces me to practice my sql anyway.
- Supercontest.
- Added a repeat-x niners svg to the jumbotron.
- Parsed and put the rules on a new site tab. Used webcomponents and zero-md to convert the md in source to html.
- Closed https://github.com/brianmahlstedt/supercontest/issues/66.
- Started working on the Season table, ticket 68.
- Verified that the remote backup to local, and then restore local from local, correctly syncs the production db to my dev machine.
- Where sqlalchemy would usually have you declare a base, manage the session, etc – flask_sqlalchemy is what I use and it abstracts a lot of that away, simply giving you a db object to do the most common tasks with.
- Met with Art about pharma:
- Recap from my old notes:
- utm params can identify the majority of traffic we generate.
- Universal application to be approved as pharmacy. Standardizing this API would be valuable for everyone, marketplace or not.
- Kayak model: redirect them, don’t buy/sell directly. Pros: Simpler. Easier.
- Amazon/Orbitz model: allow buy/sell through our website. Pros: You can generate aggregate purchase orders. Paperwork is a big aspect. You can also hold the money and do a billing cycle.
- Could offer a small client to serve smaller vendor’s prices, putting them online.
- Exit strategy is not to monopolize, it’s to sell to Amazon (like PillPack for 753m).
- Now actions:
- Build the mvp site.
- Get domain name and host.
- Populate with fake data from multiple vendors. You might be able to get some public data for generics. Some sites even list their rx, like https://auromedics.com/products/ampicillin-and-sulbactam/.
- Write template API that we’ll encourage vendors to use. Write client from excel sheet.
- Add basic user login which protects the price comp tool endpoint.
- Add basic landing page which describes the benefits for (a) pharmacies and (b) vendors.
- We are going with the orbitz model, the buy-through-us model. This gives a few benefits:
- One stop shop. One invoice.
- Can include generics, prescriptions, and med supplies in the same order.
- We can basically give credit, where pharmacies can go on a monthly billing cycle, and we pay in the meantime.
- Go speak with vendors. Get them onboard and get their data.
- Here is where you can search for some vendors: https://search.dca.ca.gov/
- Med supply vendors are huge.
- Collect what percentage? Do research, seek financial expertise here.
- Standardized universal application.
- Vendors have to be cool with us giving their data out. This should be fine; it’s free marketing.
- Go speak with pharmacies once you have a good selection of vendors and products. Get them to start using it.
- Exit sell to Amazon like PillPack for 753m.
- Met with Nel’s dad about the pathplanning app. Notes coming tomorrow after I do more research.
-
- Elbow.
- Bloodwork.
- Walk-in, 8am when they opened. Took 45 minutes in the waiting room and 5 minutes of action.
- Made a quest account and downloaded the app, can now check results on my phone when they’re ready.
- X-ray.
- Walk-in, 915am a little after they opened. Took 90 minutes in the waiting room and 5 minutes of action.
- Picked up both prescriptions from yesterday.
- Applied the topical painkiller before pull day at the gym. Felt 1000x better. It’s incredible how much of a difference it makes. It’s incredible how muted my exercise has been for almost 2 years now. Cheers, looking forward to the permanent solution.
- Pinged and finally settled all Hawaii expenses.
- Refilled all powders and pills. Threw a lot out; all that’s left is turmeric and glucosamine. Once those are gone, I won’t reorder. I eat turmeric root directly and I didn’t find much benefit from glucosamine.
- Lamborghini makes an SUV called the Urus. Its MSRP is 200k. Crazy. But, given that 50% of vehicles sales are SUVs nowadays, I get it.
- Homemade protein bars.
- Required ingredients. Just 3. My homemade nut butter, oats, and protein powder. Mix in bowl with rubber spoon then chill in fridge/freezer and cut, or just leave in bowl.
- Optional: Honey, maple, cinnamon, cacao, coconut oil, the usual suspects.
- Now I don’t have to buy clif bars for post-gym anymore! That’s the very last processed item in my whole diet, now everything is homemade!
- Django crash course (traversy media: https://www.youtube.com/watch?v=e1IyzVyrLSU).
- python manage.py [runserver|migrate|etc] of flask-scripts comes from django.
- Default port 8000.
- Can use jinja, but defaults to django’s own template engine (which is really similar anyway).9
- Comes with a lot by default. An admin interface. Gives a skeleton structure for views, models, settings, and more. Creates all the files for you, just leaving you to edit them.
- You can do a lot with django, but I still prefer flask for the most part.
- pgadmin (latest version: 4) is a much better tool for messing with your db than psql. Use it next time.
- Checked mail for the first time in >1mo. Got the replacement amazon card and activated. Also deposited the $14 treasury disbursement (I think it was a settlement from that credit leak?) using mobile checking which was nice.
- The pecans at costco are definitely the cheapest, at ~$8/lb. Bought organic pecans for ~$10/lb (from a company called I’m A Nut) on Amazon, which is worth the convenience of online + organic. This is on regular Amazon, not Fresh.
- Homemade tahini. Just like nut butter, but with seeds. Toast them, then process them. Add a little oil or salt if you want. So good.
- Bought new tupperware. Tired of lidless, wrong-sized options.
- Homemade kava. About 3 tablespoons of root and about half a liter (2 cups) of hot water makes a decent strength individual serving. Mix a little coconut oil in (the fat helps with extraction, just like others), then steep for 10 minutes. Then knead the tea bag.
- Supercontest.
- TNF verifications, first of the season. App behaved very well. Closed https://github.com/brianmahlstedt/supercontest/issues/64.
- There was only one issue. If thursday was picked, it would reject all 5 subsequent picks if you wanted to change one of the other four (which is valid). Fixed it to verify against the current picks.
- Closed the “before 2019 season” milestone.
- Chrome on mobile allows you to create desktop shortcuts from your current page, but that doesn’t work when you want the url pre-redirect. The trick to get around it? Disable wifi and mobile data, then the browser can’t follow the redirect 🙂 Then create the shortcut from the origin site.
-
- All of my limit sells executed. Should transfer money in a couple days.
- After the all the pushback, zeke signed the biggest RB deal in history. 6yr, 90m. The salary cap in basketball is weird, but the absolute max you can make in a year is about 40m, which is 2-3x higher than football.
- Chiropractor.
- Was awesome. Used a percussion machine instead of manually doing the back cracks. Still did the neck rotation cracks by hand.
- Stretching/cracking at home is fine, as long as you don’t go too far or go too jerky.
- I think mine is more of a muscle strain.
- Gonna try valerian root and kava for some natural muscle relaxant. Also gonna ice more.
- Elbow.
- Saw my primary care for a PT + cortisone referral.
- Ended up seeding 4 more appointments:
- X-ray. Called and made one.
- Blood work. Called and made one.
- Then you go back and see primary care for the followup with results.
- Then you get the referral and go to the ortho place for the steroid shot.
- In the meantime, she gave me prescriptions for higher strength pain + anti-inflammatory pills and creams.
- Dropped them off. Came back an hour later to pick up, as instructed. It had been sitting on the counter the whole time; it hadn’t started being processed.
- The pharmacist called the doctor a few minutes later to verify the amount (dosage) of anti-inflammatory cream, since it hadn’t been written on the rx. The doctor’s office was closed, so the verification would have to come the next day and the prescription would be filled tomorrow.
- This is ridiculous. They’re going to give me the same tube, no matter what. They just needed something to write for dosage on the tube. I told her to write the smallest dosage possible, achieving the exact conservative goal that such process requirements are meant to enforce. She couldn’t.
- This is stupid, but not unexpected from a superfluous workflow that charges 1 hour for something that should take 2 minutes in the first place. Medicine and pharma need more engineers.
- Ordered new running socks (12 pairs) and minimalist running shoes, total $50.
- Cool instance where amex correctly declined a stolen card close to home based on good ML with user spending habits: https://www.reddit.com/r/personalfinance/comments/czt0x2/my_wifes_amex_was_stolen_thieves_attempted_to_use/.
- Supercontest.
- Client.
- Westgate finally posted lines for week 1. Updated, tested, and did final season-readiness verifications on https://github.com/brianmahlstedt/supercontest/issues/55.
- Submitted my picks.
- Created a new ticket for tomorrow’s live-game tnf verifications (hopefully none): https://github.com/brianmahlstedt/supercontest/issues/64.
- Deployed, talked with petty about email, done.
- LB was being calculated for all games, even ones that hadn’t started yet. Shielded the winner and point calculation with status!=’P’ so that it only calculates started games. It does show the current point totals and leaderboard placement for active games, as if all were ended immediately.
- Since the production app is not started with the uwsgi autoreloader, to ingest new changes you have to run `docker-compose restart supercontest-app-prod`.
- To wipe cells in the production db, do something like `update public.matchup set winner = null where id = XXXX;`.
-
- PMI dropped below 50 for the first time since 2016: https://www.instituteforsupplymanagement.org/ISMReport/MfgROB.cfm.
- A thought experiment that usually helps people with differing opinions see some common perspective: If the world were the size of your block, would you make the same decision?
- Would you still take advantage of that loophole you found in a business, or would you tell the owner because he’s your neighbor?
- Would you still invest in that tobacco cart when he’s selling to your kids and their friends afterschool?
- All depth charts for all teams and all offensive positions in one page: https://fftoday.com/nfl/depth.php?o=one_page&Side=Off&order_by=.
- Beet stalks/leaves, radish leaves, and cucumbers cannot stay in the dank fridge drawers. They must be kept dry on the racks, or juiced immediately when I cut after delivery.
- Liquidated everything in my robinhood account except MSFT, YUM (KFC, Pizza Hut, Taco Bell), and BYND.
- This includes AMAT, MKSI, LRCX, MSB, TSM.
- Healthcare.
- Created an account on healthnet to find providers. I can now access all my ID numbers, benefits, etc.
- Chiro is covered under ancillary services, which uses an external search provider (ashlink, you can find the link on your profile page). Scheduled an appt with the 4th provider I called.
- Tried to get a PT or sports medicine appointment for the elbow cortisone. The ones I called needed a group referral from my primary care provider. Scheduled an appt with her to get that.
- My copay is $0 for everything, which is great, but overall the experience of finding a provider has been pretty bad. Getting the account set up with the right information to filter options, calling and finding that they actually don’t take healthnet, etc.
- I also never received an ID card for healthnet (I did for medi-cal), so I ordered one.
- Got an unsolicited text from a 2020 presidential campaign today. One of the most instant ways to get me not to vote for you.
-
- Started watching schitt’s creek. Good show.
- Horribly verbose article, but centers on an important piece of advice: https://medium.com/better-humans/how-to-read-academic-content-once-and-remember-it-forever-e44f26d82566. After you learn something new, summarize it to yourself every morning for the next week. This will force you to retain the information, it will require that you understand it enough to explain it, it will remind you of the small corners that are easier to forget, allowing you to look them back up, etc.
- Went to Benihana.
- Added the chrome extension “Improved YouTube” – it now defaults to 1.5 speed, removes all ads, and equalizes volume.
- The new meat tenderizer works incredibly. It uses the spike grid instead of just a mallet. Flattened >1lb breasts to under a quarter inch. Smoked curry chicken.
- Blake St. fantasy draft.
-
- This channel doodlechaos is so cool: https://www.youtube.com/watch?v=vcBn04IyELc&feature=youtu.be. He syncs classic songs with that line rider game.
- Finance.
- Great article on algorithm trading: https://medium.com/s/story/predicting-the-stock-market-is-easier-than-you-might-think-4f1e0bc05cfe.
- As a nonprofessional trader, your best bet is to follow exactly what the smart money (professionals) are doing. Jump on their trains. You can’t outsmart them, and they have a much larger influence on the market.
- Remember, the word for technology in the investment banking + hedge fund profession is FinTech.
- GDP is a fantastic predictor for success.
- ISM = institute for supply management. They publish a monthly index, based on hard data, about how the economy is trending. 50 is neutral, 0 bad, 100 good.
- If it’s hovering above 50, that’s good and you’ll see bull growth in most markets.
- If it’s increasing, no matter where it currently is, that’s good and you’ll see bull growth in most markets.
- If it’s hovering below 50, that’s bad and you’ll see bear decline in most markets.
- If it’s decreasing, no matter where it currently is, that’s bad and you’ll see bear decline in most markets.
- Therefore: Buy when ISM is below 50 but trending upward after a valley. Sell when ISM is above 50 but trending downward after a peak.
- Example report: https://www.instituteforsupplymanagement.org/ISMReport/MfgROB.cfm. This is so useful. Given the current state of slight growth but slowing rate, the advice would be to sell soon when it plateaus.
- PMI = purchasing manager’s index. JPMorgan publishes this. It’s including in the ISM report. Same general idea.
- There are tons of other css libraries out there for frontend besides bootstrap: bulma, spectre, tailwind, ant, foundation. They’re similar: bunch of classes to help lay out and style sites. Most use flexbox for gridding like bootstrap, as well as offering many similar components and utilities. Some are pure cs, some have features that require js and offer a corresponding bundle.
- Added logos to the supercontest readme: https://github.com/brianmahlstedt/supercontest/blob/master/README.md. Took a while (annoyingly) to get the md/html rendering to jive, and I did it on master like an idiot, but it looks much better now. If ever I want to do this on another landing page, it will just be a copy-paste.
- Made walnut butter. Still good, but my least favorite of the nut butters by far.
- Alembic is written by the same guy who wrote SQLAlchemy.
-
- Solid pier night for wes’ farewell yesterday. Saw Dom Mazzetti from broscience at tower 12, said wassup.
- Reread a lot of the bootstrap documentation for tables and forms.
- Supercontest.
- Updated the week_matchups and week_picks templates to use bootstrap tables properly.
- Pale green, light coral, and khaki were the primary colors – now it’s table-success, table-danger, and table-warning.
- Added routes and nav buttons for /graphql and /graph, the latter being split from the lb into its own view.
- Added season to the pick and matchup tables. Created two migrations: one for the new col without the NOT NULL constraint, then another to add it. Since the db exists already, you do the first, backfill all the values as desired, then do the second.
- Psql cmmand to write all the values: update public.pick set season=2018; commit;
- Manually edited the alembic migration to do this all in a single version file: add col, set value, add null constraint.
- Flask can’t do nested blueprints, so I basically converted week_blueprint to season_week. The matchups and picks routes use both. The leaderboard and graph routes only use season. Added similar url_defaults and value preprocessors for g, where many of the subsequent db queries are dependent on season now.
- Season addition was a lot of work. It was a nontrivial uprooting of most views/templates/models. Every db interaction basically had to be updated to specify season now.
- Reorganized the template hierarchy so that everything wasn’t just in layout.html anymore. It’s a lot cleaner now, nesting all the nav rows and everything. Each template has a corresponding js file (for the most part).
- Active-navlink logic is universal now. All have the id nav_<route>, then it just inspects window.location.pathname.split(‘/’).includes(id) to add the active class. All navs do this except the week navs, which work slightly differently. They don’t just display all available weeks, they display all 17 from the beginning, and disables the ones that aren’t available yet. This is because the nested grid, 17>12. It’s easier to just lay out the structure and fill it in as it comes, rather than make the html grid nesting dynamic. It distinguishing these ids to loop over by using weeknav_ instead of nav_.
- Added a function is_today() which does the str-int mapping for days of the week. This is already being used for restricting picks wed-sat. I added it to the fetching of scores on the /matchups route as well, so that it only checks the nfl scores if it’s a gameday (thurs, sun, mon).
- Ran into some problems because datetime.now() type objects are off in the docker container locally, as well as on the digital ocean droplet. Looks like they’re just utc:
- bmahlstedt@bmahlstedt-xps13:~/code/supercontest$ docker-compose exec -T supercontest-app-dev date
- Sun Sep 1 05:18:22 UTC 2019
- bmahlstedt@bmahlstedt-xps13:~/code/supercontest$ docker-compose exec -T supercontest-database date
- Sun Sep 1 05:18:33 UTC 2019
- bmahlstedt@bmahlstedt-xps13:~/code/supercontest$ date
- Sat Aug 31 22:18:39 PDT 2019
- Fixed by adding the following to the dockerfile:
- RUN echo America/Los_Angeles >/etc/timezone && ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
- Flask appends any unused values as query params, so for the lb/graph I had to remove the week info in url_defaults and value_preprocessor. Only need season.
- Switch from nav pills to tabs to better imply hierarchy.
- Closed the season ticket: https://github.com/brianmahlstedt/supercontest/issues/54.
- Changed everyone’s name (on the prod db) to properly split first and last.
- Deployed to production.
- Emailed everybody with the new site and instructions. Done! Last items will be wednesday’s smoketests when the lines are released.
- The new joker movie is apparently phenomenal. https://www.youtube.com/watch?v=zAGVQLHvwOY.
- Impunity is the same root as punish, immunity from punishment.
- The flask-scripts/python/alembic migrations all operate on a local database, so you have two options: run the commands in the db container or copy the db over and run the commands on the host. In order to do the former, you’d have to bloat the db with system apps like python, so I’m going to do the latter.
- ctrl-t as a vim shortcut for tabs conflicts with ctags’ shortcut ctrl-t to jump back a definition. I find the latter more useful.
- zip(*iterableWithNestedIterables) is how you unpack in python! Never knew that was the inverse of itself.