Skip to content

Instantly share code, notes, and snippets.

View NetzwergX's full-sized avatar

Sebastian Teumert NetzwergX

View GitHub Profile
@NetzwergX
NetzwergX / Microsoft.PowerShell_profile.ps1
Last active August 4, 2022 11:10
My PowerShell Profile -- includes oh-my-posh and auto completion for git, docker and dotnet and suggestions from history
# SETUP:
# Install-Module posh-git -Scope CurrentUser
# Install-Module Terminal-Icons -Scope CurrentUser
# winget install JanDeDobbeleer.OhMyPosh -s winget
# Install-Module DockerCompletion -Scope CurrentUser
# Install-Module -Name PSReadLine -Scope CurrentUser
# Install-Module oh-my-posh -Scope CurrentUser
# TODO: https://ohmyposh.dev/docs/migrating
@NetzwergX
NetzwergX / docker-compose.override.yml
Created June 17, 2021 09:33
Docker compose override for local Overleaf with mailcatcher
# docker-compose for local Overleaf with mailcatcher
version: '2.2'
services:
sharelatex:
volumes:
- ~/.sharelatex/data:/var/lib/sharelatex
links:
- mongo
- redis
- mailcatcher
@NetzwergX
NetzwergX / .oh-my-posh.omp.json
Last active November 14, 2021 09:53
My oh-my-posh v3 theme, based on powerlevel10k_rainbow (added java & dotnet, removed adornments)
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh3/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"newline": true,
"segments": [],
"type": "prompt"
},
{
@NetzwergX
NetzwergX / Polygnome.psm1
Created November 29, 2020 14:47
my oh-my-posh PowerShell style
# My PowerShell style, as mashup between PowerLinePlus, Operator and Honukai
#requires -Version 2 -Modules posh-git
function Write-Theme {
param(
[bool]
$lastCommandFailed,
[string]
$with
)
@NetzwergX
NetzwergX / app.html
Created October 19, 2020 15:16 — forked from ScottWhittaker/app.html
Aurelia Router Demo
<template>
<require from="components/navigation.html"></require>
<h1>Aurelia Router Demo</h1>
<navigation router.bind="router" class="primary-navigation"></navigation>
<div class="page-host">
<router-view></router-view>
</div>
</template>
@NetzwergX
NetzwergX / lava.util.CopyableRecord.java
Created June 7, 2020 15:15
CopyableRecord - Impl & Tests
/*
* MIT License
*
* Copyright (c) 2020 Sebastian Teumert <https://sebastian.teumert.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@NetzwergX
NetzwergX / RecordMutabilityTest.java
Last active May 8, 2020 19:58
Demonstration of mutability of records & defensive copying to address it
import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
@NetzwergX
NetzwergX / ReadMe.md
Last active December 24, 2019 11:04
Eclipse configuration

These are settings I found most helpful (start with Window > Preferences):

> Java > Code Style > Organize Imports > Number of static imports needed for .* (e.g. java.lang.Math.*): 1
Setting this to one prevents eclipse from messing up deliberately chosen static imports.

> Java > Editor > Syntax Coloring > Java > Type Variables > Enable [x]
(Choose bold and a good color e.g. cyan blue)

This allows one to use reasonable type variables, e.g. class Entity<Id> or MyMap<Key, Value>
instead of only non-descript single-letter type variables without confusing them for actual types.

@NetzwergX
NetzwergX / OptionalExt.java
Created February 13, 2019 19:24
Extension methods for Optional<E> via Manifold
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
import manifold.ext.api.Extension;
import manifold.ext.api.This;
/**
* Extends {@link Optional<T>} with two new methods for acquiring values.
*/
@NetzwergX
NetzwergX / latency.txt
Created December 3, 2018 14:54 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD