Skip to content

Instantly share code, notes, and snippets.

@mgrabovsky
mgrabovsky / numerical_methods.md
Last active November 23, 2022 16:01
Numerical methods cheatsheet
@mgrabovsky
mgrabovsky / glossary.md
Last active November 2, 2022 06:59
Plans for a glossary of terms in the area of programming language theory, type theory and formal methods (PLT, TT, FM)

A

  • abstract data type (ADT)
  • abstract interpretation
  • abstract syntax tree
  • α-equivalence (alpha-equivalence)
  • algebraic data type (ADT)
  • aliasing
  • automated reasoning
  • axiomatic semantics
@mgrabovsky
mgrabovsky / tips-plots.R
Last active April 28, 2022 09:43
Analysing my tips in cafés
library(tidyverse)
# Set Monday as the first day of the week.
options(lubridate.week.start = 1)
theme_set(theme_minimal() +
theme(panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank()))

Jupyter Data Science Notebook

Run a Jupyter Data Science Notebook (or JupyterLab?) using Jupyter Docker Stacks with the current directory linked inside:

$ podman run --rm -it -p 8888:8888 -v "${PWD}":/home/jovyan/work:z docker.io/jupyter/datascience-notebook

@mgrabovsky
mgrabovsky / dj.py
Last active May 5, 2021 18:28
A basic file encryption utility in Python using the cryptography.io library. Uses ChaCha20Poly1305 for authenticated encryption and PBKDF2 with SHA-2 to derive a secure key from a password.
#!/usr/bin/env python
import argparse
from cryptography import exceptions
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
from cryptography.hazmat.primitives.hashes import SHA256
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from getpass import getpass
import os
import sys
@mgrabovsky
mgrabovsky / cumdensity.svg
Last active September 27, 2020 12:01
Simulating observations in the Lighthouse problem in R
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
-- Source: https://kcsongor.github.io/symbol-parsing-haskell/
// Source: https://blog.jcoglan.com/2020/05/12/controlling-mutation-with-types/
use std::io;
use std::mem;
use std::str::Chars;
#[derive(Default)]
struct Stack<T> {
head: T,
rest: Vec<T>,
@mgrabovsky
mgrabovsky / Future.hs
Last active October 23, 2019 10:56
Future monad
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
data FutureM i o a
= Await (i -> FutureM i o a)
| Yield o (FutureM i o a)
| Done a
instance Functor (FutureM i o) where
fmap f (Await g) = Await (fmap f . g)
@mgrabovsky
mgrabovsky / index.md
Last active October 23, 2019 10:34
A short software build systems survey