Sun 02 July 2023
place holder
Personal Productivity
Everything markdown, including Obsidian
Unrelated to my need for a personal productivity system, I've been research everything about Markdown, particular what python libraries exist for it and what interesting things can be done with it. Obsidian is one such thing, a sort of IDE for Markdown. It isn't quite just a text editor with Markdown features, nor a wordprocessor. It is like an IDE in that it has many plug ins for manipulating Markdown for a wide range of goals and to support many personal productivity systems.
It looks promising because it seems to be a good fit for people who can't get themselves to follow a rigid order. I think I can write a lot, as long as I don't have to keep up some specific methodology for a long time. Like software development issue trackers, I can get excited about them for a while, write code in rigid parallel to my ticket activity and then the link disolves and the tickets are just a shadow of what is going on in the code I write.
I think this Obsidian thing might be able to organically adapt to the level of structure that I might feel like at any given moment.
Plans
I want to use it for
- TODO lists.
- Notes. Maybe I can use it a place to record stuff I've read online
- Project tracking, espcially side projects
If I can write the code to make it happen:
- Import starred github projects as "TODO" items or projects
- Import bookmarked mastodon posts as "TODO" items
Using a running log as a note system is new to me. I think one strategy is to write things down everyday in the daily notes. The Notes get hyperlinks and tagged. Then by searching for tags/links you can generate a synthetic document that combines the related parts of your daily log.
Read and Comment »
Sat 08 April 2023
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
:
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 »
Sun 19 March 2023
I wrote a library that serializes and deserializes markdown to and from python, but more in the style of pickle and less in the style of a document object model.
Hello markpickle
I got the name from ChatGPT.
Origin Story
I wanted an API to support as many mime types as possible. Some mime types are for the people, such as PDF, Excel/CSV. Some time types are for the machines, like json, bson.
I thought, what about HTML and text? HTML has a problem with XSS risks. Text has a problem of not having much of a standard story for "styled" plaintext. Except for Markdown. Can I use markdown as a mime type for what starts out as a JSON object?
Challenges
The app is two functions, loads and dumps and they take or return an Any
type and take or return a string. The Any
is a problem, because mypy doesn't know how to deal with arbitrarily complex types. It seems to get confused with Union
s of Union
s of Union
s. It gets confused with generics, e.g. lists that can work with any contents.
Impedance Mismatches
Markdown has some analogies:
- header groupings + paragraphs make dicts, or even nested dicts
- Lists or lists of lists
- tables are dicts, but you can only put scalars in the values. This makes python objects of a certain level of nesting unrepresentable.
- strings and non-string types can be represented, but you can only infer a number should be integer. This blocks round tripping.
Some things are impossible
- empty dictionaries, empty lists exist in python but have no representation in markdown. An empty list is just zero-length whitespace where the list is not. This blocks round tripping.
Python has no use for a lot of markdown formatting, such as bold, or code block or quote. Those things would just be strings and they'd continue to hold markdown in the string.
Read and Comment »
Sun 26 February 2023
I'm going to talk about how I'm managing my health and how it is going
Overall Goal
The overall goal is to maximize your healthspan. More and more people are making it to or close to their maximum
lifespan, of something close to 100. At the same time, more people are getting lifestyle diseases that mean they will be
sick a good chunk of that.
What I Eat
I would still be vegan if the health data wasn't panning out in favor of plant based diets. I believe the data
demonstrates that I've lucked out and my ethical preferences match up with my health goals.
I was omnivore until age 16. I read a book that made the case for vegetarianism and adopted it. I ate dairy and egg
until about age 38 or so. Despite the dairy, for most of the time I tried to be "low fat" which is somewhat
contradictory if you eat any cheese at all. For this whole time I had a healthy body weight, 145-150 lbs for a 5'11"
guy.
I am vegan for a bit over a decade. My lipid numbers are great. Blood pressure fine, but could be better.
What I do
I ran in high school, I did a few years or two of no particular exercise. After starting a desk job and getting colossal
back pain, I started doing follow-along exercise on DVD videos. That worked out great. On and off, I did bicycling,
scootering, roller-blading, hiking. I resumed running about a decade ago and have been particularly serious in the last
five.
Mood
I think that we all suffer from anger, depression and anxiety in different ratios. Depending on what ratio you got, you might have a personality, or a diagnosable disorder.
Optimizing
Between eating right (vegan) and exercising (running) I'm doing pretty good. Everything else is a micro-optimization.
I'm also pushing 50. Even if you eat right & exercise you'll still age. I got grey hairs & when the knee parts fail, they really fail. Some joints have the start of arthritis. The eyes have nuisance cataracts.
- Vitamins
- B12. Only bacteria make it, animals don't. Heck even farm animals have to take B12.
- Creatine. For sprinting & strength training
- Magnesium. Because I run and sweat a lot.
- Hibiscus - Weak anti-hypertensive.
- Coffee - makes me type faster
- Sometimes
- Algal Omega Fatty Acids. They are taken up by the brain. Who knows it if helps.
- Other B vitamins.
I used to, but no longer take multivitamins, the data on them was negative.
Sources
My favorite source on this sort of thing is Dr. Gregor. The rest of the sources are lost to memory, because they were
books I checked out at the library.
Read and Comment »