Skip to content

Instantly share code, notes, and snippets.

View schiemon's full-sized avatar

Szymon Habrainski schiemon

View GitHub Profile
{
"configurations": [
{
"name": "MergeSort (Debug)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/merge-sort.exe",
"runtimeExecutable": "${workspaceRoot}/info.sh",
"args": [
"${input:number_elements}",
import { NextApiRequest, NextApiResponse } from "next";
import { withApiAuthRequired } from "@auth0/nextjs-auth0";
import nc from "next-connect";
// Secured api endpoint.
// Possible synergy between next-connect and withApiAuthRequired from nextjs-auth0.
const handler = withApiAuthRequired(
nc<NextApiRequest, NextApiResponse>()
.get(
@schiemon
schiemon / edf.py
Last active April 13, 2021 18:47
Empirische Verteilungsfunktion mit matplotlib
import matplotlib.pyplot as plt
import numpy as np
from collections import Counter
from matplotlib.widgets import Slider
from functools import partial
(fig, ax) = plt.subplots(1, 1)
def gen(n):
ax.clear()
@schiemon
schiemon / deadlock.rs
Created February 23, 2021 12:56
Provoking a deadlock in Rust
fn make_deadlock() {
let a = Arc::new(Mutex::new(1u32));
let aa = Arc::clone(&a);
let b = Arc::new(Mutex::new(1u32));
let bb = Arc::clone(&b);
let t_a = spawn(move || loop {
do_locking("A".to_string(), "a".to_string(), &*a, "b".to_string(), &*b);
});