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
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/dmmfzotxhlghialrsvyw@forum.dlang.org
//
// 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 July 11, 2023 19:09
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);
@WebFreak001
WebFreak001 / boottime.d
Created March 3, 2020 14:30
Get windows startup boot time in D using Win32 Event Log APIs or GetTickCount64 fallback
SysTime getBootTime()
{
SysTime ret = getBootTimeUsingEventLog();
if (ret == SysTime.init)
ret = getBootTimeUsingTicks();
return ret;
}
SysTime getBootTimeUsingTicks()
{