How should I set up a personal AWS Account securely?

How should I set up a personal AWS Account securely?

How should I set up a personal AWS Account securely?

Topics to hit: - Tooling - Granted - Two factor auth - Big company features, but for personal accounts - Organizations - Cloud custodian - Multiple accounts

Read and Comment »

Vegan 3:15 Marathon Project, Part 2

Can a mediocre vegan runner match an omnivore professional?

Can a mediocre vegan runner match an omnivore professional? Part 2

Well, not yet. Here is my theory why:

  • I need about 5 years of serious running to build up to it
  • I'm starting around age 48-49, currently 50, so I'm doing this in difficult mode, as compared to if I'd started when I was 35

My marathon times to date are definitely mediocre.

Any, after a race, I do bounce back really fast, so I think the vegan-recovery advantage is a real thing, but I'm not surrounded by enough runners to make this data based opinion.

Read and Comment »

Vegan 3:15 Marathon Project

Can a mediocre vegan runner match an omnivore professional?

Can a mediocre vegan runner match an omnivore professional?

My uncle worked at the YMCA, ran sometimes twice a day as part of job as a fitness coach. He ran dozens of marathons in his life, with a known lifetime PR of 3:15 at the age of 50. He, like my Dad and everyone else at the time, ate like everyone else--neither vegetarian or vegan.

I recently saw "The Game Changers" a documentary with the thesis, "Plant Based athletes recover faster and so can work out harder and more frequently." I figure I should put that to the test.

My goal is to run a 3:15 marathon at the 2024 Marine Corps Marathon. That 13 months from now.

Can I do it?

You can take your recent races and plug them into calculators to predict your race time. Depending on the calculator, it seems like my 5k, 10k and half marathon paces are not far from where they need to be. I've never run a marathon before, so I only have predictions, which say I have quite a large gap to close.

How will I do it?

Well, eating plant based of course. But also eating clean in the currently sense of clean- low saturated fat, high fiber, high carb, etc.

Daily Goals

  • Grits or oats for breakfast
  • Something vegan for lunch and dinner
  • Less restaurant food than usual
  • Less

Supplements and why

  • B12 - because there's no bacterial sources of b12 in modern vegan diet.
  • D - because I'm indoors a lot
  • Hibiscus - to reduce blood pressure by 5-10 points
  • Omega 3 Fatty Acids, Lutein - Speculated to help with brain, nervous system, vision because I'm not young anymore.
  • Magnesium - to replace magnesium lost to sweating
  • No multivitamin - too many effects

Post workout

  • 20g protein after workouts. Replace any protein lost, rebuild muscles, tendons, etc.
  • Salt tablet, like Nuun. To prevent feeling exhaustion post workout
  • Watermelon juice. Citruline is speculated to reduce muscle soreness, speed recovery
  • Cracker or some sugary drink. Speeds restocking glycogen in liver and muscles

Pre-workout/Race

  • Beet juice - temporary increase to Vo2 max/cardiovascular efficiency
  • Taurine - 3g speculated to help with recovery
  • Creatine - for speed bursts and has good data supporting its use in sports
  • Caffeine - for speed, data appears to support net-benefit

Actions

  • Hired a coach and will follow the plan as close as I can
  • Sleep 11 hours a day
  • Do something to tighten up scheduling in the rest of my life to make time for enough running

Information Tracking

  • Use Garmin tracker
  • Use Garmin chest strap HR tracker
  • Use Strava and Final Surge

Gear

  • Carbon plate shoes on race days only
  • Maximalist shoes because I'm used to them and changing is as risky as any merit or demerit of a shoe type
Read and Comment »

Catching up on TypeScript

After avoid JavaScript for a few years, I must reface my nemesis, the undefined, the null, the falsy.

Hello TypeScript, again.

Surprise!

So, I had ChatGPT write a merit tracker. It wrote up some Javascript I don't even recognize anymore.

  • const is everywhere
  • looks like requires() won the module wars
  • JS isn't restricted to a DOM and can deal with CLI args with yargs and the file system with fs ... but
  • fs is already passé and fs-extra is the new hotness
  • export is now a keyword and not an IIFE (Immediately Invoked Function Expression)
  • There are things like python f-strings, e.g. console.log(``${date}.``)

I had the bot convert it to TypeScript. Usefully it gave me step-by-step instructions to convert it myself, rather than giving me a big blob of TypeScript.

Testing

I installed jest, several times to be sure. I ended up installing all of these.

{
  "@jest/globals": "^29.5.0",
  "@types/jest": "^29.5.0",
  "jest": "^29.5.0",
  "ts-jest": "^29.1.0"
}

Then I had to install a jest-config.js file. Without it, the tests ran twice, one time for the typescript version and another time for javascript version. The relevant magic is the testRegex, particular the last part that restricts running tests against the .ts version of the file.

This later turns out to be a bad idea. testMatch: ['**/*.test.(ts|tsx)'], is better, and less likely to be buggy regex. The real problem was I wasn't specifying a dist folder in tsconfig.json e.g. "outDir": "dist".

/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
    roots: [
        './tests'
    ],
  preset: 'ts-jest',
  testEnvironment: 'node',
    "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
    "moduleFileExtensions": [
        "js",
        "ts",
        "tsx",
        "json"
    ],
};

Astonishing

If I imported import jest from 'jest'; I got error messages about jest not having certain properties. So I removed the import altogether and it worked! Astonishing.

I also ran into a problem where the mocks failed to have the right properties. The error message: Cannot read properties of undefined (reading 'readJsonSync')

The solution, put this into tsconfig.json:

"esModuleInterop": true

Coverage

Now coverage is not working, it consistent reports 0% coverage and acts generally like the tests are using .js and coverage is looking at .ts or vica versa.

The problem was .ts and .js files were compiled to the same directory and the coverage tool was looking at the wrong one. I had to tell typescript to compile the .js files to a dist folder.

Linting

I'm working throught that right now. I'll publish again when I get it working.

Read and Comment »