Skip to content

Instantly share code, notes, and snippets.

View MBulli's full-sized avatar

Markus MBulli

View GitHub Profile
import typing
from pathlib import Path
import plotly.graph_objects as go
def plotly_get_top_view_camera() -> go.layout.scene.Camera:
return go.layout.scene.Camera(
projection=go.layout.scene.camera.Projection(type='orthographic'),
up=dict(x=0, y=1, z=0),
import plotly.graph_objects as go
def plotly_generate_slider(figure: go.Figure, sliderValues, numTracesPerStep=1, title='') -> go.Figure:
assert len(figure.data) % numTracesPerStep == 0
steps = [] # slider steps
numTraceGroups = int(len(figure.data) / numTracesPerStep)
for i in range(0, numTraceGroups):
@MBulli
MBulli / grid_layout_subplots.py
Last active December 13, 2022 09:18
Plotly Python: Arrange subplots in a grid layout
def grid_layout_subplots(traces: typing.List[go.Trace], titles: typing.List[str] = None, ncolumns: int = 1, fig: go.Figure = None) -> go.Figure:
if fig is None:
fig = go.Figure()
ncolumns = int(min(ncolumns, len(traces)))
if ncolumns == 0:
return fig
nrows = int(math.ceil(len(traces) / ncolumns))
@MBulli
MBulli / FireDacBlobStream.pas
Created December 11, 2022 17:34
FireDAC BLOB streaming with MS SQL Server
unit FireDacBlobStream;
interface
// https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Support_for_Blob_Streaming_in_FireDAC
uses
Data.DB,
FireDAC.Comp.Client,
FireDAC.Phys.Intf,
@MBulli
MBulli / GnuplotPerf.cpp
Created July 24, 2021 09:20
Questionable benchmark code for pipline communication with gnuplot on windows (see https://sourceforge.net/p/gnuplot/bugs/2204/)
// GnuPlotPerf.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#define NOMINMAX
#include <Windows.h>
#undef near
#undef far
#include <iostream>
#include <sstream>
@MBulli
MBulli / TortoiseVSColors.reg
Last active February 19, 2018 21:31
Tortoise Git Merge - Visual Studio color scheme
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\TortoiseGitMerge\Colors]
"ColorIdenticalRemovedB"=dword:008787d4
"ColorIdenticalRemovedF"=dword:00000000
"ColorAddedB"=dword:00a9ddc1
"ColorIdenticalAddedB"=dword:00a9ddc1
"ColorTheirsAddedB"=dword:00a9ddc1
"ColorYoursAddedB"=dword:00a9ddc1
"ColorEditedB"=dword:0087f0f0