Hi! I'm Wolf Mermelstein
Today I Learned's cover image
A collection of random disconnected things that I learn on given days.
personal featured

Contents

2024-11-20

Learned about the “Dreadful Diamond on Derivation” problem…

Full credit to this stack overflow

Basically, you have an inheritance hierarchy that looks like

  A
 / \
B   C
 \ /
  D

The issue is that if we do A.D(), we could be referring to A::B.D() or A::C.D().

So you can do class A : public virtual B, public C{…) to only inherit the actual methods from C to solve this problem.

2024-09-26

I set up neotest and nvim-dap and then removed them from my config. Turns out I prefer vscode once I’m debugging/testing.

Some vscode shortcuts:

  • control+1 focus the text editor group
  • control+shift+e toggle focus of the file tree and text editor group
  • “control+`” focus the terminal, and then toggle it

2024-09-25

In information theorylinguistics, and computer science, the Levenshtein distance is a string metric for measuring the difference between two sequences. The Levenshtein distance between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other. It is named after Soviet mathematician Vladimir Levenshtein, who defined the metric in 1965.[1]

2024-09-18

Learned sql, used <https://sqlbolt.com\>. Very helpful tutorial.

2024-09-08

Neovim has built in spell checking! No plugins needed

https://neovim.io/doc/user/spell.html :setlocal spell spelllang=en_us enable built in neovim spell checking z= - see spelling suggestions

2024-09-05

You can use git mv <from> <to> and git rm [-r] <thing> to move and delete things with git without consequences if you have things like submodules.

2024-08-15

https://github.com/mikavilpas/yazi.nvim

Make dunst go to the top right origin = "top-right"; offset = "10x10";

2024-08-15

Bash variable parameter extraction + glob stuff

  • ${VARIABLE}%ff removes the first occurrence of ff from the back of VARIABLE
  • ${VARIABLE}#ff removes the first occurrence of ff from the front of VARIABLE
  • ${variable//pattern/replacement} is a form of parameter expansion that replaces all occurrences of pattern with replacement in the value of variable

2024-08-14

Open source alternative to zoom https://p2p.mirotalk.com/

2024-08-09

In bash you can use ** to get a list of files in the current directory. You can even pattern match with like **.nix

So, like

for file in **; do
    echo $file
done

And file is the relative path of the file from where you run the command.

2024-08-02

css has a not function to target things that are not the thing. So like, p:not(.foobar #barbar) will target everything that is not of class foobar and with id barbar.

2024-08-01

Capital W and capital B take you forward and backward a word in vim without regard for periods

WindowsError

Apparently python has a Windows specific error message

2024-07-22

You can easily get example videos in various formats at <https://sample-videos.com/\>

2024-07-20

gm goes to the center of the current line in vim

2024-07-16

Powershell is open source. You can use Powershell as your default Linux shell. Who knew.

Powershell as Linux Shell

Also, Windows has a cool app called “Sandbox,” which you can create xml config files to template, that are basically Windows virtual machines without bloat (not even the microsoft store). They work really well, I think they should be a distribution of Windows itself.

Windows sandbox

https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/windows-sandbox-overview

2024-07-13

Used this to create this script to yoink a specific section from a markdown string (for example, I want to get the # Description section’s paragraphs only)

export function getContentOfSection(
  markdown: string,
  header: string,
  depth: number = 1,
) {
  const ast = unified().use(remarkParse).parse(markdown)

  const output: string[] = []
  let inHeadersSection = false
  let nextIsWantedText = false
  visit(ast, (node) => {
    if (
      node.type === 'heading' &&
      node.depth === depth &&
      node.children.length > 0 &&
      node.children[0].type === 'text' &&
      node.children[0].value === header
    )
      inHeadersSection = true
    if (inHeadersSection) {
      if (nextIsWantedText) {
        if (node.type === 'text') output.push(node.value)
        else if (node.type !== 'paragraph') return false
      }
      if (node.type === 'paragraph') nextIsWantedText = true
    }
  })
  return output.join('\n')
}

2025-03-31

Going to try to be more consistent with this again!

console.trace('How did we get here?')

Will do a console.log and also spit out a stack trace

2025-04-03