Skip to content

Instantly share code, notes, and snippets.

View hageldave's full-sized avatar

David Hägele hageldave

  • University of Stuttgart
  • Germany / Stuttgart
View GitHub Profile
import java.util.ArrayList;
/**
* BilloProfiler is a low fidelity manual profiling utility.
* Billo = Billig (German slang) = cheap/tacky.
* <br>
* You need to manually put {@link #start()} and {@link #stop()} at the piece of code you like to profile,
* and sprinkle {@link #split(String)} inbetween to get timings for different sections.
* Then you can simply print the profiler to get the total time and fractions of the time for the sections.
* You can use the global {@link #instance} to facilitate profiling over multiple classes.
@hageldave
hageldave / bokeh_server_skeleton.py
Last active October 14, 2025 13:04
A simple bokeh server example
from typing import Callable
from bokeh.server.server import Server
from bokeh.document import Document
from bokeh.models import Div, ColumnDataSource
from bokeh.plotting import figure
import pandas as pd
import sklearn.datasets as toy_data
def create_application(doc):
# Autoencoder example for dimensionalilty reduction of MNIST
# Requires tensorflow and seaborn
# e.g.: pip install tensorflow-cpu seaborn
import tensorflow as tf
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hageldave
hageldave / BarycentricGradientPaint.java
Last active May 17, 2024 15:53
BarycentricGradientPaint is a java.awt.Paint implementation for triangular color interpolation (using barycentric coordinates). The svg file shows the result of the demo app (embedded image).
/* Copyright 2021 David Haegele - Source from JPlotter */
import java.awt.Color;
import java.awt.Paint;
import java.awt.PaintContext;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
@hageldave
hageldave / isolines.svg
Created June 25, 2019 13:23
svg export of JPlotter's isoline demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hageldave
hageldave / barycentric.svg
Last active December 29, 2021 18:40
svg triangle barycentric color interpolation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import static org.apache.batik.anim.dom.SVGDOMImplementation.SVG_NAMESPACE_URI;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
import org.apache.batik.anim.dom.SVGDOMImplementation;
import org.apache.batik.transcoder.TranscoderException;
@hageldave
hageldave / DrawOnDemand.java
Last active June 2, 2019 16:27
AWTGLCanvas draw on demand
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ComponentAdapter;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.awt.AWTGLCanvas;