Skip to content

Instantly share code, notes, and snippets.

View malkia's full-sized avatar

Dimiter 'malkia' Stanev malkia

View GitHub Profile
dvc
oxen
xethub
dagshub
doithub
pachyderm
...?
@malkia
malkia / gist:768683a52baf41fba318535ca34877ba
Created January 22, 2024 01:46
restart batch file with admin rights
net sessions 1>nul 2>nul || (
rem Restart with admin rights the same script
PowerShell "Start-Process -FilePath '%0' -Verb RunAs -ArgumentList wait"
exit %ERRORLEVEL%
)
@malkia
malkia / hook.c
Created October 26, 2023 04:52 — forked from mmozeiko/hook.c
reads process stdout + stderr and prints it out as it becomes available
// compile this to hook.dll
// for example, with MSVC: cl.exe /LD /MT /O2 hook.c /Fehook.dll
#include <windows.h>
// get this from https://github.com/kubo/plthook
#include "plthook_win32.c"
static plthook_t* hook;
@malkia
malkia / etw_createfile.c
Created October 26, 2023 04:32 — forked from mmozeiko/etw_createfile.c
Monitor which files are accessed with ETW
// this code will work only when compiled as 64-bit code, and on Windows 10
// older Windows version might require different structure definitions
#define NOMINMAX
#define INITGUID
#include <windows.h>
#include <evntrace.h>
#include <evntcons.h>
#pragma comment (lib, "shell32.lib")
@malkia
malkia / malkia_diff.txt
Created May 8, 2023 20:28
patch to my windows build of envoy (plus some of contrib)
diff --git a/.bazelrc b/.bazelrc
index 637a9a65be..bb77b3fb71 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -430,3 +430,5 @@ build:windows --dynamic_mode=off
try-import %workspace%/clang.bazelrc
try-import %workspace%/user.bazelrc
try-import %workspace%/local_tsan.bazelrc
+
+try-import %workspace%/../../malkia/top.bazelrc
@echo off
set BAZEL_SH=c:\program files\git\usr\bin\bash.exe
set PATH=c:\program files\git\usr\bin;c:\program files\git\cmd;d:\sys\bazel;c:\python311;c:\python311\scripts;%PATH%
set MSYS2_ARG_CONV_EXCL=*
set MSYS2_PATH_TYPE=inherit
set TMPDIR=C:/Windows/TEMP
set TEMP=C:/Windows/TEMP
set TMP=C:/Windows/TEMP
bazel --output_base=f:\_eb build -k --enable_runfiles --config=windows -c opt --config=sizeopt --config=msvc-cl envoy
bazel --output_base=f:\_eb run --enable_runfiles --config=windows -c opt --config=sizeopt --config=msvc-cl envoy
@malkia
malkia / t1.bzl
Created January 1, 2023 21:41
force_compilation_mode bazel transition rule
force_compilation_mode = rule(
# implementation = lambda ctx:
# DefaultInfo( runfiles = ctx.runfiles(
# transitive_files = depset(
# transitive = [ depset( transitive = [x[DefaultInfo].files] ) for x in ctx.attr.data ]
# ))),
implementation = lambda ctx:
DefaultInfo( files = depset(
transitive = [ depset( transitive = [x[DefaultInfo].files] ) for x in ctx.attr.data ]
)),
@malkia
malkia / buiild.cue
Last active February 10, 2022 02:17
cue example of references using integer indexes, then transforming them into bits
import (
"list"
)
build: {
proj1: {
deps: [
"proj2",
]
}
@malkia
malkia / gist:015754b862d948e451a91702ecb39241
Created April 10, 2021 05:55
CMake from Visual Studio 2019 (16.9)
1> CMake generation started for default configuration: 'x64-Debug'.
1> Command line: "cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\commonextensions\microsoft\cmake\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="D:\p\imgui-fetchcontent\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="c:\program files (x86)\microsoft visual studio\2019\professional\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe" "D:\p\imgui-fetchcontent" 2>&1"
1> Working directory: D:\p\imgui-fetchcontent\out\build\x64-Debug
1> [CMake] -- The C compiler identification is MSVC 19.28.29913.0
1> [CMake] -- The CXX
Selecting Windows SDK version 10.0.20277.0 to target Windows 10.0.19042.
Microsoft (R) Build Engine version 16.9.0+5e4b48a27 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Checking Build System
Performing download step (git clone) for 'glfw-populate'
Cloning into 'glfw-src'...
BUG: run-command.c:520: disabling cancellation: Invalid argument
fatal: destination path 'glfw-src' already exists and is not an empty directory.
fatal: destination path 'glfw-src' already exists and is not an empty directory.