Skip to content

Instantly share code, notes, and snippets.

View Nikolaj-K's full-sized avatar
💭
I'm combinating Why's.

Nikolaj Kuntner Nikolaj-K

💭
I'm combinating Why's.
  • DLR Germany, IST Austria, Infineon, ...
  • Vienna
View GitHub Profile
@Nikolaj-K
Nikolaj-K / dependent_bernoulli.py
Created August 31, 2025 21:01
Sampler for two processes with Bernoulli trial marginals
"""
Code and prompt used in the video
https://youtu.be/xcE_0azawvM
"""
"""You'll get two tasks
First part:
Consider a joint distirbution of two random variables X_k with k in {a, b} (i.e. two random variables X_a and X_b),
over a finite outcome sets of size n_a and n_b.
Explain what the marginal distributions are.
@Nikolaj-K
Nikolaj-K / moving_quantily_series.md
Created August 23, 2025 22:56
On capturing probability mass in a shrinking interval

""" Script to the video at https://youtu.be/8w4jHN1LsnY """

===== Moving quantile series ===== === Preliminary - Exponential distribution example === Density: $p_\mu(x) := F'(x) = \frac{1}{\mu} {\mathrm e}^{-\frac{x}{\mu}}$

@Nikolaj-K
Nikolaj-K / geometric_sum_gen_monpmials.tex
Created August 4, 2025 19:33
A generalization of the geometric sum away from using just monomials
"""
Proof prsented in the video
https://youtu.be/Ydyhe7KdRsk
"""
Reminder:
=== Theorem 1, the geometric sum and series formulae ===
$\sum_{k=0}^n a^k = \dfrac{a^{n+1}-1}{a-1}$
@Nikolaj-K
Nikolaj-K / compute_order_statistics.py
Last active July 28, 2025 18:45
Compute the order statistic (by default: for the uniform distribution on [0,1])
"""
Code for the video at
https://youtu.be/CquQe7Y05VA
This script will be easy to generalize, also.
"""
from datetime import datetime
import imageio.v2 as imageio
from io import BytesIO
@Nikolaj-K
Nikolaj-K / yappers_smart_follower_gains.hs
Created July 25, 2025 08:35
Somnia yapper's smart follower gains as of 250725
# For an elaboration, see the description at the top of the follower-gain page at
# https://gist.github.com/Nikolaj-K/4aab20f7858267eded3f7e98dd1a980e
De.sol@desola__xn 3000.0 gained
3000.0 % SMART follower gain throughout 28 ranked days.
1 to 31 followers (dates 250326 and 250723)
Dmitry@dmitrysitskiy 2200.0 gained
2200.0 % SMART follower gain throughout 72 ranked days.
@Nikolaj-K
Nikolaj-K / yappers_follower_gains.hs
Created July 24, 2025 14:57
Somnia yapper's follower gains as of 250724
The data below shows the follower gains of Somnia yappers, when looking at
the first and last day they appeared on the 7-day Kaito leaderboard.
Example: @lovaniceth entered on March 23th and is there on July 23th also, in which time
he grew his following from 11991 to 13549, making for a gain of (13549/11991)-1 or 12.993%.
I post the dataset comprising 469 users twice, once sorted by longevety on the leaderboard,
and once further below by gain.
I don't include users who were on the board for just one day or who lost subscribers (negative gain).
@Nikolaj-K
Nikolaj-K / nft_holdings.hs
Last active July 19, 2025 14:21
NFT holdings of top 450 Somnia yappers ranked by boost (no delegate)
#1 with 112 NFTs: 25 quills, 7 uprising, 25 grillz, 2 koda, 25 deed, 10 bambi, 10 pixcape, 8 demons
#2 with 140 NFTs: 1 quills, 2 uprising, 25 grillz, 50 bambi, 37 pixcape, 25 demons
#3 with 49 NFTs: 1 quills, 1 grillz, 2 koda, 39 deed, 1 bayc, 5 mayc
#4 with 27 NFTs: 25 quills, 2 pixcape
#5 with 51 NFTs: 1 quills, 1 uprising, 16 grillz, 1 koda, 12 deed, 9 bambi, 7 pixcape, 4 demons
#6 with 28 NFTs: 2 quills, 1 uprising, 2 grillz, 1 koda, 16 deed, 6 bambi
#7 with 24 NFTs: 1 quills, 1 uprising, 1 grillz, 1 koda, 14 deed, 2 bayc, 3 mayc, 1 bambi
#8 with 27 NFTs: 10 quills, 11 bambi, 6 pixcape
#9 with 19 NFTs: 1 koda, 11 deed, 2 bayc, 5 mayc
#10 with 12 NFTs: 12 quills
@Nikolaj-K
Nikolaj-K / yapper_api_data_250717.py
Created July 17, 2025 21:32
Yapper API dicts of about 500 Somnia yappers.
DCT = {
"aixbt@aixbt_agent": {
"user_id": "1852674305517342720",
"username": "aixbt_agent",
"yaps_all": 29726.45,
"yaps_l24h": 15.09,
"yaps_l48h": 39.52,
"yaps_l7d": 172.28,
"yaps_l30d": 1933.83,
"yaps_l3m": 4468.66,
@Nikolaj-K
Nikolaj-K / autocorr_of_chain.py
Last active July 12, 2025 16:14
Computing the autocorrelation, its spectrum and the power spectrum for a set of simple Markov chains
"""
Code described in the video
https://youtu.be/yyHd7BGGVp8
Note: A day after recording, I refactored the script to use a more continuous
random variable (no jump at full circle). I find this gives a nicer to read plot.
Secondly, I've also added a tiny `class State`, abstracting away the state indices
and conversions using string.ascii_uppercase.index.
"""
@Nikolaj-K
Nikolaj-K / plot_peoples_lifespans.py
Last active July 9, 2025 00:12
Plot people's overlapping lifespan with bars
import matplotlib.pyplot as plt
IMAGE_DIRPATH = r"your/path/to/lifespans.png"
PEOPLE = [
("Voltaire", 1694, 1778, "Philosopher"),
("Hume", 1711, 1776, "Philosopher"),
("Rousseau", 1712, 1778, "Philosopher"),
("Kant", 1724, 1804, "Philosopher"),
("Fichte", 1762, 1814, "Philosopher"),