Thursday, February 28, 2019


  • Talked to the Best Buddies coordinators. They do monthly social hours (last thursday of every month at Q’s billiards in West LA. I’m going to go to the next one.
  • Night Crew Labs’ new website! https://www.nightcrewlabs.com/.
  • PW
    • Sklearn has a ton of cool machine learning capability. You can even do data analysis on text, finding correlations and such.
    • WSGI. Request handling and routing is different than application logic.
  • Squarespace is a very popular platform for building websites.
  • Ag will automatically skip folders like venv, so make sure to take that into account when searching for stuff that might be in site-packages.
  • Supercontest
    • Reinstantiated a lot of the flask-user routes. Played with them a bit. Tried to customize most of it by integrating the default forms and such into the navbar of my supercontest page. Ultimately decided against the customization. I can do it later, and right now I want to focus on function rather than style.
    • The navbar at the top is now in an ok place, with home, user, and signout.
    • Played with PyCharm a bit more.
    • SCP is great to move files between. It goes source -> destination. For example, to move the production db to your local dev machine, scp -i mykey southbaysupercontest.com:~/code/supercontest/data/supercontest.db ./test.db.
    • python manage.py db migrate -m “description of change” after you modify the models. Then go to an existing db and python manage.py db upgrade.
    • Pycharm allows you to enter an SQL console on the database in question, which is nice.
    • If you have an existing database with a version that isn’t tracked in the current history (the migrations folder), then internet might tell you to init/migrate/upgrade. This is fine, but it’s a shotgun approach. It’s a wipeover. If you know what version the old database is close to, you can just go into the db and overwrite the value in the alembic_version table, then upgrade as usual.
    • Copied the database over from the production server and upgraded it to the most recent model, which accommodates users and logins.
    • When pycharm is connected to the db, it locks it, so the app can’t write to it. You can disconnect in pycharm with a right-click.
    • The prod database now has a user! Me. I deleted the example user.
    • Aligned the th.

Wednesday, February 27, 2019


  • Played with Pycharm a little bit. Told it which venv/python to use for this project.
  • Supercontest
    • Added instantpage (https://instant.page/) to the main layout. Should speed page load with prefetch. Seems safe.
  • Finished with both seasons of Ozark now.
  • Got lunch with jcriss. Checked out the Redondo Beach Bay Club for the first time.
  • Started reading the book The Four Agreements. I’ve heard good things. Overall, not very impressed. Seemed straightforward.
    • Be impeccable with your word. No gossip. No lies. Pretend you are speaking on live tv at all times.
    • Don’t take anything personally. Other people assume something about you? Ignore it, be yourself, and prove them wrong! This applies to compliments as well as insults.
    • Don’t make assumptions.
    • Always do your best. Take action to enjoy the action, not to expect the reward. Sometimes working twice as many hours won’t mean you get there any faster.
    • Be a child! Be a dog! Explore the world with curiosity and delight.

Monday, February 25, 2019


  • Submitted an application to volunteer with Best Buddies! Honestly teared up a little bit while reading about it.
  • Bought and brined the lamb for tomorrow’s cook. First time smoking lamb! The costco business center has a pretty incredible selection of cuts.
  • Macros: I’d like to aim for something like 100/200/80 for grams of Carb/Protein/Fat, which is a calorie distribution of 20/40/40%. This totals about 2000kCal/day.

Saturday, February 23, 2019


  • Went and saw a live taping of America’s Funniest Home Videos (AFV)! Overall, was a lot of fun. Carlton is the host now. The audience is pretty involved. Comparing this production to my SpaceX webcast production was very interesting. They’re very similar, and I’m thankful to have the experience. Live is very different. Carlton could retake anything that had a mistake.
  • DMV
    • Registered the Ninja as PNO (planned non-operation). It’s no longer insured, as well. $22.
    • Provided proof to the DMV that the BMW is insured. If they detect a vehicle is registered, but not insured, they will suspend the registration. I went online to provide this proof after I received the DMV letter, but AAA had already provided proof of insurance to the DMV, so the website informed me and all was good.

Friday, February 22, 2019


  • HN/PW/M/FW:
  • I could add this blog to my website and host it personally!

Tuesday, February 19, 2019

  • AGM = absorbent glass mat (type of motorcycle battery).
  • Was thinking about replacing the BMW battery. The current one is ~3yrs old. It hasn’t really been driven much. Now that the bike is garaged, we’re coming out of winter, and it’s in LA instead of the Bay (higher temp), the battery should last longer. I don’t expect to require trickle charging every week. I’ll drive it about once a week to the gym, and that should keep it tended for at least another year of use. When you do buy another battery, expect about $150.
  • All chores now that I'm back. Dishes, cleaned snake tank, opened the center hole for the litter tray up a bit, unpacked.
  • Watched a few videos from Athlean X, specifically the tennis elbows ones. He suggests a great stabilizing hang from a bar to strengthen the surround shoulder/forearm muscles to take load off the elbow.
  • HN

Monday, February 18, 2019


  • Drove from the Bay to LA today on the 1200. Crazy trip. Left at 1:30, a little hungover from Nick’s wedding yesterday. Got 5 hours of sleep. Stopped twice before the Grapevine, both for gas/food. Hit the grapevine around 7pm, after the sun had gone down. I was already cold and exhausted. It’s been weirdly freezing here in California lately, even just being outside. The temperatures on Tejon Pass were in the 30s. There was snow everywhere. I was on a motorcycle going 80mph, adding a huge wind chill factor. I was wearing jeans and a sweatshirt lol. It was the coldest I’ve ever been in my entire life. After the summit, I had to pull into a rig’s brakecheck area to sit in Allie’s car and reheat my core before continuing. Total trip time was about 7.5hrs, including the 3 stops.

Thursday, February 14, 2019


  • Great summary of machine learning: https://vas3k.com/blog/machine_learning/.
  • Started tracking the foods I eat with MyFitnessPal. I’ve got a solid diet, but I’m curious what my macro counts are, so I want to get more analytical about it.
  • PSD2 = Payment Services Directive. SCA = Strong Customer Authentication. They’re standards for transferring money with apps and services.
  • Twilio allows you to make calls, send texts, and more...programmatically! Basically communication APIs.
  • Authy is an alternative to Google Authenticator. It’s a 2FA app.
  • Good summary of Google’s JS style preferences: https://medium.freecodecamp.org/google-publishes-a-javascript-style-guide-here-are-some-key-lessons-1810b8ad050b. I’m in agreement with basically all. The semicolon still kinda annoys me.
  • Remember, var is function scoped and let is block scoped (smaller). So if you have a for loop in a function, the let variable is only available there. If you define that same variable as var in the for loop, the whole function will have it. If you use var or let outside of a function, they’re both globally scoped. You should never use var, only use let or const.
  • Medium article on graphql at Netflix. They're very happy. What would be 8 direct rest API calls between client and server is now one client call and 7 server to server interactions. This is much faster, as the latency on server resources is much less. Abstraction in queries is great also!
  • Lucene is a search engine by Apache. It’s what the Atlassian products used (Lucene health check failed!). Elasticsearch is built on top of it, and is a very common tool to search, analyze, and visualize data.
  • Schema-on-write is when the data is validated before it is written, making sure it adheres to the schema. On the other hand, schema-on-read is when any data can be submitted and then the user can fetch it and apply their own lens (schema) to it (or part of it). Write is better for conformity, and more efficient. Read is better for flexibility.
  • Normalization is when a database contains many tables, each with a small atomic amount of information, then relations stitch the tables together. It avoids redundancy. A query then requires many joins, which can be inefficient. Denormalization, then, is when take a normalized database (NOT one that has never been normalized before, like a huge table with everything from the start), and intentionally add redundant information back in to make common queries more efficient. This makes read operations faster, while slightly making write operations slower (because they have to write in two redundant locations now).

Wednesday, February 13, 2019


  • Called a few motorcycle service centers in the bay to make sure they'd be prepared for a quick visit this weekend. Peninsula Motorsports was the closest one that is open on Saturdays (Monday is a holiday so I'd have to do service Tues and leave Wednesday otherwise). I called and ordered front and rear new Michelin Pilot Road tires. Better for commute and wet roads. Should be a little under $350 for both.
  • Took the Ninja off my auto insurance policy and added the BMW in its place. Premium went up by about $30. Would have been $450 to just add it, about the same as the Ninja. Insuring the salvage vehicle is less of a return.
  • SC
    • Moved the flask-user templates into my app dir so that I could customize the email text. Played around with the insertion of a brady image into the body of the html email, but image embed has a lot of caveats. You can base64 encode the source image into a string and include that, which seems to be the safest. In any case, I left everything as the default for now.
  • PyCharm professional has a built-in DB browser. Maybe I’ll get it later. For now, I’ll use external tools to fill the holes. Ended up finding a free plugin (database-navigator). Allows basically the same functionality as db browser. Love it.
  • Awesome report about who requested user data and if Reddit complied: https://www.redditinc.com/policies/transparency-report-2018.
  • Remember, MongoDB can just be thought of as an efficient, persistent dictionary. There’s flask_pymongo to integrate mongo easily with flask apps, and there’s flask_mongoalchemy as an ORM.
  • Read founder’s weekly.

Tuesday, February 12, 2019


  • Internal Revenue Code (IRC) Section 83(i) is the one that states that taxes on ISO and RSU exercise can be deferred for 5 years, avoiding the AMT trap.
  • i18n = internationalization, l10n = localization, g11n = globalization. It’s the first and last letter, then the number of letters in between. These are the standards for software to basically translate between languages. It means you can have one website and use flask-babel to serve it in english and chinese, rather than having two templates for everything.
  • SC
    • To override basic templates (and just check what sort of stuff flask-user gives you under the hood), go to site-packages/flask_user. The views under the hood are expected infrastructural ones: login, logout, forgot_password, change_password, register, confirm_email, that sort of stuff. The templates under the hood basically have the same names and roles.
    • Proper flask secret key again with urandom.
    • Integrated the supercontest with the flask-user example I had been sandboxing. Email registration and user management now fully works with the sbsc. Styling is gross, but that will come later - it works!
    • Played with the username capability of flask-user. It’s not as seamless. I’m just gonna keep email for now.
  • Joe Rogan tweeted about Tesla after close at $312.84. Curious what tomorrow opens at.
  • Elon’s first son, Nevada, was 10 weeks old and died of SIDS. They then had twins: Griffin and Xavier. Then they had triplets: Kai, Saxon, and Damian.

Monday, February 11, 2019


  • Updated resume and sent it to a woman I met at CrossFit on Saturday, Eunice Quezon. She’s from the bay but currently works as a technical PM at Warner Bros in LA.
  • Researched beef cuts and grades. Already knew prime -> choice -> select, but was curious which part of the cow the cuts were from:
    • The chuck is the front shoulders, around the neck The round and shank are the rear legs / butt area. Neither of these produce the incredible cuts. They’re better for burgers, pot roasts, rump roasts.
    • The brisket is the pec. Below the head, above the legs.
    • Everything else is in the region between the legs. 3 primary sections, from head to tail: rib, short loin, sirloin.
    • Rib: ribs, ribeyes.
    • Short loin: t-bone, porterhouse, filet mignon (tenderloin).
    • Sirloin: tri-top, sirloin.
    • The last section is the belly underneath those three, called the plate and flank. That’s where we get skirt steak and flank steak.
  • SC
    • Created a ticket for the production deployment container: https://github.com/brianmahlstedt/supercontest/issues/27.
    • Downloaded sqlite db browser (same one I had on my SpaceX MBA). Just makes it easier to graphically observe a db, rather than prodding it from the command line.
    • Had to go into the southbaysupercontest gmail account and enable access for less secure apps again. I thought I had already, but in any case it’s working now.
    • Went through Ling Thio’s starter app, comparing and merging with my supercontest app to template some of the basics. Looks good.
    • Pruned a lot of the flask-simple-app for my purposes. Refreshed on many flask extensions, like -login, -wtf, etc.
    • There is a lot of stuff that these extensions provide under the hood. I like that, but I also hate it. You get a ton of methods, decorators, and properties like current_user, login_user(), roles_required, blah blah. It also gives you entire routes and views, like the /user/ subdomain.
  • A nice all-in-one flask template app which serves a site with forums; https://github.com/akprasad/flask-forum.
  • reCAPTCHA is an open source project from Google that allows easy captcha integration.
  • A rainbow table is the table used in a dictionary attack, the one I mentioned above. It’s a list of common passwords and their algorithm-hashed results, to compare to other databases for matches.

Saturday, February 9, 2019


Friday, February 8, 2019


  • Remember, node allows server side use of js. You can write your app in js instead of python. This allows you to build content BEFORE responding to requests, rather than waiting until the browser builds the dom and then manipulating it clientside. Express is then the framework, just like flask. Adonis is another popular one. Npm is node's package manager, just like pip.
  • Mongo tutorial. Mongoose is the node library to interface with it.
  • Node tutorial. It’s single-threaded, non-blocking, and asynchronous. Package.json, node_modules, package-lock.json (if either is modified). `node filename.js`. There are core modules, like the python standard lib (http, fs, os, path, etc). There are also events and timers, just like javascript.
  • Streams are an important concept. Say I had a large 1GB text file. If a user requests it, you don’t want to load the whole file in memory then serve it. You can send the response through a stream, which only gives a chunk at a time. This will load your server less. You can also do this with writable streams. You can also do this will stuff that isn’t a file, like a connection (socket).
  • TCP does ordering and checksum verification behavior. UDP does not.
  • DIfference between socket and websocket? A socket is much more general, just a send/receive connection over TCP/IP. A websocket is a type of socket - usually one that uses HTTP and lasts permanently. You can think of a socket as a lowlevel TCP network layer, then websocket is an application layer above it (just like HTTP).
  • Postman is a cool tool for API development (so you don’t have to curl your server over and over).
  • JWT = JSON web tokens. If I login in to a website, its authentication server can return a JWT. Then if I make subsequent API calls to the application, I pass the JWT instead of my creds again. It’s just an auth token. It’s signed and encoded, but it’s not encrypted (it’s not hiding anything, it’s not my password).
  • HN
  • Cat training.
    • 2nd attempt at the orange tray with the hole today. Failure: he pooed on the bathroom floor. Full story below.
      • Gbro has been using litter his entire life, literally for years. He’s been using the litterbox on top of the toilet for over a month, with no issues. Same litter, same location. Now let’s introduce a little change. The litterbox tray is swapped out for one with a small hole in it, beginning the process of training while the hole gradually opens over a long period of time. Every waking hour for about a day I’ve been placing him on the toilet in the correct position. Giving him exact instructions for literally where to place all four feet, as well as his butt. After not going to the bathroom for a while, he begins meowing. I place him on the toilet again, for maybe the twentieth time, his butt 1 inch away from the same litter he’s known his entire life. He jumps off. A minute passes and he meows again with urgency. I place him back on the toilet. He sits. He meows. All he has to do is simply let go. He jumps off. I go to the kitchen to get some coffee. I come back and he dumped all over the bathroom floor. Oh I’m sorry, was the small hole new? Was it unfamiliar? SO IS THE FLOOR, WHICH YOU’VE NEVER USED IN YOUR ENTIRE LIFE.
    • There is a set of in-between trays with better hole sizes to transition. It’s a set of two, one for between red and orange, and another for between orange and green. It’s FORTY FIVE DOLLARS for two pieces of plastic. Nope.
    • Instead, I applied duct tape underneath the hole. It’s full right now, but I’ll slowly open up a gap. I had to tape long strings to reach the vertical portions of the plastic, otherwise it couldn’t bear the cat’s load.
  • Volunteering. Looked up a few opportunities in the south bay. I have the time right now, and I think it would be a wonderful way to give back, as well as grow myself.
    • Walk With Sally. Kids who have been impacted by cancer (lost a parent, etc). Tried to sign up, but the form was broken.
    • PCAP (Prostate Cancer Awareness Project). Tried to sign up, but the form was broken.
    • SPCA (Animals!). You have to commit for 6 months. The first step is an infosession, with the next one scheduled for March 6th.
    • Cancer Support Community of Redondo Beach. Emailed info@cancersupportredondobeach.org to ask about opportunities!
  • Organized my training schedule for the next couple weeks, breaking down all the technical tutorials I’d like to complete before applications.
  • Mosaic was probably the first browser monopoly. Then Netscape. Then Internet Explorer. Then enter the modern age.
  • Browsed the Eloquent Javascript book: https://eloquentjavascript.net. Good stuff.
  • Mocha and Jasmine are probably the two most popular testing frameworks for javascript.
  • Fantastic tutorial on the nitty gritty of building an emulator: http://www.emulator101.com/. I skimmed it, but I’m not going to go through the entire thing right now.
  • /opt is for third-party packages, not part of the OS distribution. /var is for logs. /usr is for applications installed by the administrator (first-party packages).
  • No Starch Press is a service that provides nerdy books: https://nostarch.com/about. I’d subscribe to a weekly digest, but it’s not digital.
  • Sass is an awesome CSS extension. It allows you to specify variables, nest selectors, import other files, functions (mixins), define blocks of style (like classes) and have other blocks compose (add) them, and arithmetic operators!

Thursday, February 7, 2019


  • JQuery and Angular tutorials.
  • Smoked a brisket. Looked up Traeger and Yoder grills. There are some awesome smokes (and pellets) out there. Would like to upgrade at some point in the future.
  • Survey of Python devs in 2018: https://www.jetbrains.com/research/python-developers-survey-2018/.
    • Webdev, machine learning, data analysis, all expected.
    • 84% on py3, only 16% on 2. Surprised by this.
    • Flask beat out Django! 47% to 45%.
    • Pytest beat unittest.
    • PostgreSQL beat MySQL and SQLite.
    • Ansible beat Puppet.
    • Jenkins beat Gitlab, Travis, and Bamboo (which was only 3%).
  • A piece of sx-setuptools that Spencer outsourced! https://github.com/sputt/qer.
  • Remember, AJAX isn’t a language. It’s primarily just the use of an XMLHttpRequest object to retrieve new data asynchronously, allowing you to refresh a portion of a page without reloading the whole site. It usually is registered as an onclick function, fetches data, then updates elements in the current dom as needed.

Wednesday, February 6, 2019


  • Bitwise operation tutorial on sololearn. Basically just convert to binary, then compare the two bytes (or however many). Each will be a row of 8 numbers and perform the Boolean operator on each digit (columns). And, or, xor, not, masking, shifting.
  • Cryptography tutorial on sololearn. Symmetric encryption is when the same key encrypts and decrypts. This is like a cypher. Asymmetric encryption is when two keys are used (like public/private in RSA). == at the end means a key is base64.
    • Databases do not store your password. They use a one-way hash to encrypt it, then next time run it through the same encryption and see if the result matches, not your password.
    • If someone ever got a hold of the algorithm, they could just run a TON of common passwords through it, then compare to the database to find matches. This is a dictionary attack. The was around this is by salting, where a secret key (random string, usually) will be added to the password before hashing it.
  • Created a journal for all my BBQ sessions! Backfilled the previous.
  • Bootstrap tutorial, sololearn.
  • Called Del Amo to check on the crash estimate. Their Ducati tech is pretty backed up but he should have the estimate soon.
  • Added my BMW information to all my docs. Looked at AAA insurance for it. I’ll do the swap (taking ninja off) next week before I head up north.
  • jQuery, React, Angular, and Vue are frontend framework leaders.
  • Kotlin is a modern alternative to Java. You can write the server backend with this. It can be used to write an app where PHP or Python would otherwise, but its primary use right now is for Android apps. Swift is still primarily used for iOS apps.
  • React Native allows you to build both the frontend and the backend with the same language (so you don’t need Swift or Kotlin or Java). It’s pure javascript (with React as well, obviously). This means the same application source is used for all platforms.
  • CDN = content delivery network. Usually a URL you can point to in an HTML file to include another library, like jquery.

Tuesday, February 5, 2019

  • Remember duck typing, as opposed to strong typing. It means you don't need to specify type; if it looks like a duck and walks like a duck, it's probably a duck.
  • snake_case. camelCase. PascalCase.
  • Node.js is javascript without a browser. It’s a runtime environment. While js runs natively in the browser for client-side scripting, node allows js to run server-side as well.
  • Java and C++ are faster than javascript (or nodejs), by about a factor of 2. Python and Ruby are slower, by about a factor of 5-10.
  • Finished the Openlearn JS course.
  • Move all new programming courses to drive (in separate docs, rather than this blog).
  • Compiled some level info. This is all for senior software engineer.
Company
Salary/yr
Stock/yr
Bonus
Google
177299
153754
35346
Facebook
179000
159579
28974
Microsoft
155059
29311
24695
Amazon
154259
150648
19227
Apple
178131
98820
25721
Netflix
425000
7750
0

  • Finished the Openlearn PHP course. Didn’t really take notes or memorize this, just kinda wanted to get a feel for how things were done a while ago. Modern languages have more comprehensive server-side scripting capability (even the Python I’m also an expert at).
  • Updated resume with some of the recent frameworks I’ve been studying.
  • Php studying! Added doc to programming notes.
  • Cookies are small files that the server gives back to the client. They contain information about the transaction, allowing a “session” to continue with that data (until expiration). They could contain a username or something else that you don’t want to have to provide every single time over and over and over with each subsequent request.
    • The browser will send cookies (for that domain) with each request (if they exist), then the server usually checks for them (if they exist) and skips some logic if they do.
    • They can apply to a whole domain, or subsets.
    • Third-party cookies: when your server applies it to another domain as well (like for advertisements). This is often looked down upon, for obvious reasons.
    • They can be encrypted or not, apply to https or http only, and more. They are not safe for secure information.
    • They literally take up space on the client’s machine (albeit small).
  • I've never had to use NumPy before, since all my linear algebra was in school with MATLAB, but it's a tool for that. Linear algebra, matrices, n dimensional arrays, etc.
  • REST APIs are stateless, remember. You  should also use nouns instead of verbs for all routes, except the last one can be a verb. Go from collections (plural) to singletons, like domain/users/bmahlstedt/files/resume.pdf.
  • PUT creates a new resource, if not already existent. PUT is idempotent. POST sends data. Sometimes that might mean creating a resource. Not necessarily idempotent.

Monday, February 4, 2019


  • Instability is not the ladder you want to climb - in regard to staying at a company where lots of people are leaving. Some say that promotions come more easily as gaps open, but this is bad advice.

Friday, February 1, 2019


  • levels.fyi is a website with TONS of comp information for all the software companies I’m looking at. Based on my level (somewhere II-senior), my goal for base salary is 200k (anywhere) or 400k (netflix). It’s honestly that big of a difference. Equity around 200k is fine. Signing bonus of ~50k is fine.
  • Finished HTML sololearn.
  • Finished CSS sololearn.
  • Supercontest.
    • Got everything in working condition again! Cleaned up the git branches and the nginx configuration. They’re nicely symlinked now.
    • Just use `python manage.py runserver` for local testing. No reason to involve nginx and the production webserver, unless you’re explicitly testing the proxy aspect or load-testing. Flask-script really is pretty great.