RSSAmplifier

Blog

Home

Recent content on Home

johansivertsen.comRSS feed ↗16 posts

Latest posts

Pratt Parsing

Pratt Parsing I recently stumbled into a Pratt parsing based parser at work. A helpful collegue send me this article: Simple but Powerful Pratt Parsing , which does a great job at explaining things, but it still had me staring at the minimal implementation for a long time before I got it (with said collegues help, thank you Rasmus). So this post is for you if you don't have Rasmus handy. If you…

Treesitter Emacs On Windows

Configuring Treesitter with precomiled grammars on windows If you are using treesitter on windows, it can be a bit of work to configure everything in order to compile grammars on your own. Using pre-compiled grammars is possible, but it's not very obvious how, so here is my small guide. Download precompiled grammars First step is to find some source of precompiled grammars. tree-sitter-langs is…

Configuring Hunspell in Emacs on Windows

First off we must install Hunspell on the machine and expose it via exec-path : winget install hunspell After restarting powershell this is handy for getting the exec path: Get-Command hunspell | select -ExpandProperty Source | Split-Path | clip Insert into exec-path and verify that it works via (executable-find 'hunspell') Getting dictionaries We can find out where hunspell looks for dictionaries…

Stochastic Report Generator

Forget about LLMs or even Markov Chains, sometimes correct grammar is all you need for perfectly correct gibberish: I'm happy to annnounce my translation of the stochastic report generator (stokastiske rapportgenerator). The story of the generator goes back to 1996 where it was released by Peter Sestoft , now head of the ITU Computer Science Department. There is a good write up (in danish) about…

Emacs 29 C# Setup

Use C# in Emacs 29.1 The internet is full of C# on Emacs guides that are basically outdated now that emacs includes csharp-mode and eglot out of the gate. But, I could not find any guides on what to do instead. Probably because it's really simple. Still you need to know where to look: Emacs 29.1 comes preloaded with variable eglot-server-programs configured to look for omnisharp . So all you have…

Einstein and Truchet

As you probably know, we now have an aperiodic monotile! I was particularly intrigued by an example patch given towards the end of the great introduction found on aperiodcal.com . Here a post is shared where Dan Piker overlays the new tile with a Truchet pattern . Progressively larger patches of the Truchet-style pattern. I wanted to see a larger patch of that pattern, and I really wanted to see…

Learn MetaPost

Consider the following pseudo-code: f = 8 f = 4*x What is x ? Most programmers will probably say that x is unknown. But anyone else will tell you that x is obviously 2. MetaPost will tell you the same. This allows you to write code in a rather different manner than most other programming languages. It makes it a joy to use MetaPost to illustrate geometrical relationships. MetaPost is generally a…

Riddles

Riddles Here are some riddles, I didn't come up with them but I don't know the original authors. Let me know if you find any copyright infringing content on this page and I will remove it. I won't post the solutions here to avoid spoilers, but I will be happy to share them via. email or otherwise. I did post some hints so don't skim the page. If you have more riddles I would also love to hear them…

Intensity

Intensities are extremely useful in the insurance industry. In this post I will introduce intensities in the setting of pricing out a simple life insurance. Life insurance Take the most simple life insurance: We have to pay $1$ to the customer if he/she dies before the age of $n$ years old. When tasked with coming up with a price for this insurance, we want to know how likely the customer is to…

Snell's law in MetaPost

Snell's law tells us how a monochromatic light travels through a boundary between two different materials: \( n_1\sin\alpha=n_2\sin\beta\) The \( n_1,n_2\) values are constants determined by the respective materials. This makes for fun MetaPost drawings. The code below draws a prism with a ray of light being refracted according to Snell's law. Sometimes the angle and materials puts \(…

Lecture note on Locality Sensitive Hashing and MinHash

A lecture note with references on Locality sensitive hashing and MinHash . The lecture was given as part of the Algorithm Design Workshop class at ITU, 2018.

Area of annulus from single number

An annulus is a geometric object made up of two circles like this: The area of the annulus is clearly \( \pi R^2 - \pi r^2=\pi(R^2-r^2)\). At first glance we might think it is enough to know the difference \( R-r\) to calculate the area of the annulus. But, since \( f(x)=x^2\) is not a linear function this will not work. However, if we store the length of tangent of the inner circle contained in…

The trapezoidal integration method

Trapezoidal integration Say we want to approximate the definite integral \( \int_a^bf(x)dx\) 1 of some smooth function \( f: \mathbb{R}\rightarrow\mathbb{R}\). Depending on the nature of \( f\) we might not be able to obtain an exact solution. Instead we can use numerical integration methods to approximate the value of the integral. Here we will be looking at the trapezoidal method. The…

Publications

The space complexity of inner product estimation Rasmus Pagh and Johan Sivertsen, ICDT 2020, Preprint Scalable and Robust Set Similarity Join Tobias Christiani, Rasmus Pagh and Johan Sivertsen, ICDE 2018, Poster Fast Nearest Neighbor Preserving Embeddings Johan Sivertsen, arXiv Distance Sensitive Bloom Filters Without False Negatives Mayank Goswami, Rasmus Pagh, Francesco Silvestri and Johan…

Thesis

Similarity Problems in High Dimensions PhD Thesis, ITU, November 2017 Scalable learning through linearithmic time kernel approximation techniques Master Thesis, ITU, March 2014

About

Welcome to theses pages. I am a Copenhagen based software developer with a background in theoretical computer science. Here you can find my publications and the occasional blog post. Thanks for stopping by.