Skip to content

Instantly share code, notes, and snippets.

use std::{
fmt::{Display, Formatter},
io::Write,
};
// Gibt es einen Unterschied zwischen
// static WINCOM: [[usize; 3]; 8] = ... // und
// const WINCOM: &'static [[usize; 3]; 8] // ?
// Außer, dass ich bei expliziter Static-Lifetime eine Refernz angeben muss?
static WINNING_COMBINATIONS: [[usize; 3]; 8] = [
@stnwtr
stnwtr / gitea.docker-compose.yml
Created September 4, 2021 19:46
Simple gitea docker-compose setup which disables the ssh-server.
version: "3"
networks:
gitea:
volumes:
database:
gitea:
services:
@stnwtr
stnwtr / BasicAuthenticationHandler.java
Created May 28, 2021 09:13
Secure a page using http basic authentication
import io.javalin.core.security.BasicAuthCredentials;
import io.javalin.core.util.Header;
import io.javalin.http.Context;
import io.javalin.http.Handler;
import io.javalin.http.UnauthorizedResponse;
import org.jetbrains.annotations.NotNull;
public class BasicAuthenticationHandler implements Handler {
private final BasicAuthCredentials credentials;
@stnwtr
stnwtr / tedscrape.py
Created October 21, 2020 17:21
Scrape some TED-talk subtitle and pretty print it
from os import system
from colorama import Fore
from requests import get
class Part:
def __init__(self, part):
parts = part.split("\n")
self.time = parts[0]
import javafx.application.Platform;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import java.util.Timer;
import java.util.TimerTask;
public class AnimatedTitle {
public interface Animation {
@stnwtr
stnwtr / HiddenKeyListener.java
Last active March 1, 2019 18:00
HiddenKeyListener for JavaFX
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
class HiddenKeyListener<T extends Event> implements EventHandler<T> {