Skip to content

Instantly share code, notes, and snippets.

View MagicAndre1981's full-sized avatar
💭
I may be slow to respond for the next weeks

MagicAndre1981

💭
I may be slow to respond for the next weeks
View GitHub Profile
// ==UserScript==
// @name @chaoticvibing Twitter Blue Nerd - twitter.com
// @namespace Violentmonkey Scripts
// @match *://*.twitter.com/*
// @match *://*.x.com/*
// @grant none
// @version 1.9.2
// @author @chaoticvibing - GH @busybox11
// @description 11/9/2022, 11:45:28 PM
// @updateURL https://gist.githubusercontent.com/busybox11/53c76f57a577a47a19fab649a76f18e3/raw
@kapsiR
kapsiR / Update-DotNet-Global-Tools.ps1
Created September 28, 2022 06:32
Update all dotnet global tools at once
function Update-DotNet-Global-Tools
{
foreach ($toolInfoRow in $(dotnet tool list -g | Select-Object -Skip 2))
{
$toolInfo = $toolInfoRow.Split(" ", [StringSplitOptions]::RemoveEmptyEntries)
$toolName = $toolInfo[0]
$toolVersion = $toolInfo[1].Trim()
# Fetch version from NuGet
$nugetInfo = (dotnet tool search --take 1 $toolName | Select-Object -Skip 2)
@davidfowl
davidfowl / MinimalAPIs.md
Last active November 18, 2024 18:55
Minimal APIs at a glance
@ADeltaX
ADeltaX / main.cpp
Created March 22, 2021 15:38
DWM Thumbnail/VirtualDesktop IDCompositionVisual example
#include <Unknwn.h>
#include <Windows.h>
#include <ntstatus.h>
#include <winternl.h>
#include <wrl\implements.h>
#include <comutil.h>
#include <dcomp.h>
#include <dwmapi.h>
#include <dxgi1_3.h>
#include <d3d11_2.h>
@EtherZa
EtherZa / RetargetFramework.cs
Last active July 5, 2021 09:14
Visual Commander script to retarget all loaded Visual Studio projects to a specified .net version (TargetFramework).
// Retarget all loaded projects to the .net version specified in "TargetFramework"
// Execute with Visual Commander (https://marketplace.visualstudio.com/items?itemName=SergeyVlasov.VisualCommander)
// **********************************************************
// NOTE: NuGet packages need to be reinstalled post execution
// **********************************************************
using EnvDTE;
using EnvDTE80;
using System.Collections.Generic;
@OlegKarasik
OlegKarasik / Demo.cs
Last active January 30, 2023 14:35
Code Tip: How to work with asynchronous event handlers in C#?
public class Demo
{
public event EventHandler DemoEvent;
public void Raise()
{
this.DemoEvent?.NaiveRaiseAsync(this, EventArgs.Empty).GetAwaiter().GetResult();
Console.WriteLine("All handlers have been executed!");
}
}
@Zhentar
Zhentar / EtwStackCaching.md
Last active October 3, 2021 16:06
Unlocking the secrets of ETW: Stack Caching

ETW Stack Caching

"Stack Caching" (or Stack Compression as PerfView calls it) is a feature of ETW designed to reduce trace buffer & etl file sizes by de-duplicating stack traces. Naturally, as an ETW feature it is documented solely through obtuse (likely accidental) references and hints in Microsoft tooling. And so the documentation is left to stubborn reverse engineers dedicated ETW enthusiasts such as myself.

The Windows version studied for this was Windows 10 1809 64-bit. I do not think this feature has changed significantly since its introduction, but I have not verified that.

Basics

In trace buffers, the compressed stacks are emitted with the Stackwalk task guid, like regular stackwalks, but with opcodes for events (as labeled by WPA) like "Stack Walk: Delete Definition" and "Stack Walk: Reference [User]". "Reference" entries contain a 'StackKey' value that uniquely identifies a stack trace definition. "Stack Walk: Delete Definition" is logged when cached stacks are evicted; from the MOF def

@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active November 18, 2024 01:03
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@goldshtn
goldshtn / analyze.py
Created March 4, 2017 15:22
.NET Core on Linux LLDB analysis scripts
#!/usr/bin/env python
#
# analyze.py Example of an LLDB script that loads SOS and runs a command
# for analysis of a .NET Core application on Linux/macOS.
# Requires LLDB matching the version of libsosplugin.so for your
# CoreCLR version, and gdb.
#
# USAGE: analyze.py [--memory] [--stacks] COREFILE
#
# NOTE: To run this as stand-alone, you might need to fix some bad symlinks
#include <windows.h>
void SetWindowBlur(HWND hWnd)
{
const HINSTANCE hModule = LoadLibrary(TEXT("user32.dll"));
if (hModule)
{