Skip to content

Instantly share code, notes, and snippets.

View WebFreak001's full-sized avatar
💾
Saving the world

Jan Jurzitza WebFreak001

💾
Saving the world
View GitHub Profile
@WebFreak001
WebFreak001 / pptx_edit.py
Created March 1, 2025 13:21
Python utility to edit PPTX presentations without dependencies through simple string replacements and image insertions. Basically use this to just replace placeholder variables in slides and conditionally show slides based on variables as well as adding generated images (like plots) in slides at easily editable spots. Tested with LibreOffice PPT…
# Copyright 2025, Jan Jurzitza
# SPDX-License-Identifier: CC0-1.0
# dead simple string.replace- & string.index-based pptx creator from template
# pptx files. Basically performs a simple string search & replace in the pptx
# and outputs that as a copy.
#
# Can also replace images, which have the search key in the "title" property of
# a placeholder image in the pptx, which can be replaced with an arbitrary
# replacement image on disk (by path) or an in-memory PNG image.
diff --git a/dsymbol/src/dsymbol/conversion/first.d b/dsymbol/src/dsymbol/conversion/first.d
index c9ac1b6..196bd22 100644
--- a/dsymbol/src/dsymbol/conversion/first.d
+++ b/dsymbol/src/dsymbol/conversion/first.d
@@ -237,10 +237,192 @@ final class FirstPass : ASTVisitor
currentSymbol.addChild(symbol, true);
symbol.acSymbol.protection = protection.current;
}
+
+
@WebFreak001
WebFreak001 / dpq2vibed.d
Last active January 2, 2022 15:03
dpq2 postgresql example with vibe.d and GEOGRAPHY(POINT) usage
import vibe.vibe;
import dpq2;
import std.random;
// not shared/__gshared to have a connection on each thread (TLS)
Connection psql;
// not shared static this to instantiate the psql variable on each thread as well
// with shared static this, multithreading would break.
// Although default vibe.d behaviour is not multithreaded.
static this()
@WebFreak001
WebFreak001 / fun.d
Created December 23, 2021 12:45
flashy
import core.sys.windows.windows;
import std.random;
extern(Windows) int x(HWND w, LPARAM lparam) nothrow
{
FLASHWINFO f;
f.cbSize = f.sizeof;
f.hwnd = w;
f.dwFlags = 7;
try { f.dwTimeout = uniform(300, 2000); }
@WebFreak001
WebFreak001 / keybindings.json
Created November 11, 2020 08:51
my VSCode keyboard shortcuts
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "ctrl+`",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+9",
"command": "editor.action.commentLine",
"when": "editorTextFocus"
@WebFreak001
WebFreak001 / Pink.colorscheme
Created October 2, 2020 16:41
KDE Konsole light color theme
[Background]
Color=239,239,239
[BackgroundFaint]
Color=239,239,239
[BackgroundIntense]
Color=239,239,239
[Color0]
@WebFreak001
WebFreak001 / dlang_wmi.d
Last active May 29, 2020 09:37
querying WMI in dlang over COM
// https://forum.dlang.org/post/[email protected]
//
// warning: this is not what you would consider good code, you want
// to make a proper library for the COM classes and types and make sure
// really all resources are freed. I mostly try to do so with all the
// scope(exit) expressions here but for example the VARIANT usage is
// actually wrong and should use proper types.
import core.stdc.config;
import core.stdc.stdio;
@WebFreak001
WebFreak001 / EscapeShellParam.cs
Created May 26, 2020 08:43
Escape shell parameters for calling with the Win32 "CommandLine" argument (Process.StartInfo.Arguments)
/// <summary>
/// Escapes any given string input so that it can be reversed into
/// exactly this string by the Win32 CommandLineToArgvW method. Does not
/// perform any operation on the param string if it doesn't contain
/// whitespace or quotes.
/// </summary>
/// <param name="param">
/// The parameter to escape which can simply be appended to a whitespace
/// separated process parameter string list. (plus whitespace to
/// separate)
@WebFreak001
WebFreak001 / valve-index-linux.md
Last active December 25, 2024 06:25
Getting my Valve Index to run flawlessly on ArchLinux with i3wm

Getting my Valve Index to run flawlessly on ArchLinux with i3wm

I've bought the Valve Index VR headset and wanted to play on Linux. I had done a lot of tinkering with my Linux Machine up to this point so quite a few things on the headset initially had issues working alright.

I have listed all of the problems I encountered on ArchLinux with Valve Index and Steam VR in this post and how I managed to solve nearly all of them.

When I first plugged in my headset, turned on the controllers and started

@WebFreak001
WebFreak001 / dateFromIsoWeek.d
Last active March 11, 2020 17:00
calculate from ISO week calendar date (year, week, weekday) into gregorian calendar date (year, month, date)
/* hoping to get this into phobos: https://github.com/dlang/phobos/pull/7420 */
Date dateFromISOWeek(short isoWeekYear, ubyte isoWeek, DayOfWeek weekday) @safe pure
{
immutable adjustedWeekday = weekday == DayOfWeek.sun ? 7 : weekday;
immutable dayOffset = (isoWeek - 1) * 7 + adjustedWeekday;
Date date = Date(isoWeekYear, Month.jan, 3);
immutable startOfYear = date.dayOfWeek;
return date + days(dayOffset - startOfYear);