Skip to content

Instantly share code, notes, and snippets.

View slimsag's full-sized avatar
😸
Herding cats

Stephen Gutekanst slimsag

😸
Herding cats
View GitHub Profile
@slimsag
slimsag / ramblings.md
Last active December 13, 2023 08:02
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

slimsag@hexopsblade15:~/Desktop/beyang/symf$ CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 CC='zcc' CXX='zxx' go build -ldflags='-extldflags=-F/home/slimsag/Desktop/beyang/symf/sdk-macos-12.0/root/System/Library/Frameworks' -o test ./cmd/symf
# github.com/sourcegraph/symf/cmd/symf
warning: unsupported linker arg: -headerpad
warning: unsupported linker arg: 1144
warning: unsupported linker arg: -no_pie
warning: unsupported linker arg: -pagezero_size
warning: unsupported linker arg: 4000000
warning: unsupported linker arg: --compress-debug-sections
warning: unsupported linker arg: zlib-gnu
@slimsag
slimsag / args
Created February 20, 2022 01:58
C:\Users\slimsag\Desktop\zig\zig-out\bin\zig.exe build-lib C:\Users\slimsag\Desktop\mach2\gpu-dawn\src\dawn\dummy.zig -lc++ C:\Users\slimsag\Desktop\mach2\gpu-dawn\zig-cache\o\6bc980b450b4b05fab4cd621a1ba86cd\glfw.lib -lc -lgdi32 -cflags -g1 -std=c++17 -DDAWN_ENABLE_BACKEND_NULL -DDAWN_ENABLE_BACKEND_D3D12 -IC:\Users\slimsag\Desktop\mach2\gpu-dawn/libs/mach-glfw/upstream/glfw/include -IC:\Users\slimsag\Desktop\mach2\gpu-dawn/libs/dawn/out/Debug/gen/include -IC:\Users\slimsag\Desktop\mach2\gpu-dawn/libs/dawn/out/Debug/gen/src -IC:\Users\slimsag\Desktop\mach2\gpu-dawn/libs/dawn/include -IC:\Users\slimsag\Desktop\mach2\gpu-dawn/libs/dawn/src -D_DEBUG -D_MT -D_DLL -- C:\Users\slimsag\Desktop\mach2\gpu-dawn\src\dawn\dawn_native_mach.cpp -cflags -IC:\Users\slimsag\Desktop\mach2\gpu-dawn/libs/dawn/src -g1 -std=c++17 -- C:\Users\slimsag\Desktop\mach2\gpu-dawn\libs\dawn\src\dawn\common\Assert.cpp C:\Users\slimsag\Desktop\mach2\gpu-dawn\libs\dawn\src\dawn\common\DynamicLib.cpp C:\Users\slimsag\Desktop\mach2\gpu-dawn\li
error(compilation): clang failed with stderr: zig: warning: argument unused during compilation: '-nostdinc++' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-nostdinc++' [-Wunused-command-line-argument]
In file included from C:\Users\slimsag\Desktop\zig\zig-out\lib\zig\libcxxabi\src/cxa_aux_runtime.cpp:14:
In file included from C:\Users\slimsag\Desktop\zig\zig-out\lib\zig\libcxx\include\typeinfo:75:
C:\Users\slimsag\Desktop\zig\zig-out\lib\zig\libc\include\any-windows-any\vcruntime_typeinfo.h:121:13: error: target of using declaration conflicts with declaration already in scope
C:\Users\slimsag\Desktop\zig\zig-out\lib\zig\libc\include\any-windows-any\vcruntime_typeinfo.h:69:7: note: target of using declaration
C:\Users\slimsag\Desktop\zig\zig-out\lib\zig\libcxxabi\include\cxxabi.h:30:27: note: conflicting declaration
error(compilation): clang failed with stderr: zig: warning: argument unused during compilation: '-nostdinc++' [-Wunused-command-line-argument]
zig: warning:

WIDL compiler incompatibilities with Windows SDK

I attempted to compile the IDL files distributed in https://github.com/microsoft/win32metadata/tree/master/generation/WinSDK/RecompiledIdlHeaders using the latest (7.0.1-rc.1) version of the Wine IDL compiler, called WIDL. Unlike Microsoft's MIDL compiler which ships with Visual Studio, WIDL is open source.

More importantly, WIDL contains patches to generated header files that make e.g. COM calling conventions compatible with mingw-w64 and clang when targetting GNU ABI.

CREATE SCHEMA partman;
CREATE EXTENSION pg_partman SCHEMA partman;
CREATE ROLE partman WITH LOGIN;
GRANT ALL ON SCHEMA partman TO partman;
GRANT ALL ON ALL TABLES IN SCHEMA partman TO partman;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA partman TO partman;
GRANT EXECUTE ON ALL PROCEDURES IN SCHEMA partman TO partman; -- PG11+ only
GRANT ALL ON SCHEMA my_partition_schema TO partman;
GRANT TEMPORARY ON DATABASE sg to partman; -- allow creation of temp tables to move data out of default
postgres=# SELECT sp.series_id, sp.time AS interval_time, SUM(value) as value, null as metadata
postgres-# FROM series_points sp JOIN repo_names rn ON sp.repo_name_id = rn.id
postgres-# WHERE series_id='s:7390958469D3357348D1873F0D7EE7D1130023CDE9AE614F6F945ACEBF4DD36D'
postgres-# GROUP BY sp.series_id, interval_time, sp.repo_name_id
postgres-# ORDER BY sp.series_id, interval_time, sp.repo_name_id DESC;
series_id | interval_time | value | metadata
--------------------------------------------------------------------+------------------------+-------+----------
s:7390958469D3357348D1873F0D7EE7D1130023CDE9AE614F6F945ACEBF4DD36D | 2020-09-01 00:00:00+00 | 0 |
s:7390958469D3357348D1873F0D7EE7D1130023CDE9AE614F6F945ACEBF4DD36D | 2020-09-01 00:00:00+00 | 0 |
s:7390958469D3357348D1873F0D7EE7D1130023CDE9AE614F6F945ACEBF4DD36D | 2020-09-01 00:00:00+00 | 0 |
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const process = std.process;
const fs = std.fs;
const ChildProcess = std.ChildProcess;
var a: *std.mem.Allocator = undefined;
pub fn main() !void {