Skip to content

Instantly share code, notes, and snippets.

View thakyZ's full-sized avatar
👬
This emoji was one to show up when searching soup 👍

Neko Boi Nick thakyZ

👬
This emoji was one to show up when searching soup 👍
View GitHub Profile
param(
[Parameter(Mandatory)][string]$vmName
)
$InformationPreference = "Continue"
$ErrorActionPreference = "Stop"
try {
$vmPartitionAdapter = Get-VMGpuPartitionAdapter -VMName $vmName
if ($vmPartitionAdapter) {
Write-Information "Removing Partition Adapter. Checkpoints work."
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution.md
Last active January 8, 2026 13:35
Fix DNS resolution in WSL2

Permanent WSL DNS Fix (WSL 2.2.1+)

If you're encountering ping github.com failing inside WSL with a Temporary failure in name resolution, you're not alone — this has been a long-standing issue, especially when using VPNs or corporate networks.

This issue is now fixed robustly with DNS tunneling, which preserves dynamic DNS behavior and avoids limitations like WSL’s former hard cap of 3 DNS servers in /etc/resolv.conf.

DNS tunneling is enabled by default in WSL version 2.2.1 and later, meaning that if you're still seeing DNS resolution issues, the first and most effective fix is simply to upgrade WSL. Upgrading WSL updates the WSL platform itself, but does not affect your installed Linux distributions, apps, or files.

To upgrade WSL, follow these steps,

@pmnlla
pmnlla / tweet_from_sink.py
Last active November 14, 2019 17:13
tweet_from_fridge with replies (Python)
import sys, os, time
import tweepy
#Credit to KonradIT on GithubGist for making the original script, tweet_from_fridge.py
#I had only modified it so it can reply to tweets, nothing else.
#All credit goes to the original author.
keys = dict(
consumer_key='put',
consumer_secret='your',
@Lanilor
Lanilor / rimworld-xml-patching.md
Last active September 25, 2024 07:27
Random stuff about XML patching

Notes

  • This document is still a draft. Don't rely on any information until it is done and tested.
  • This is a more advanced guide with some special cases, improvements and optimizations. If you need to know the basics, read this guide.

Compatibility patches (with FindMod)

You can use cores PatchOperationFindMod to create conditional patches when certain mods are loaded without the need of an external library.

<Operation Class="PatchOperationFindMod">
    <mods>
@HugsLibRecordKeeper
HugsLibRecordKeeper / output_log.txt
Created October 22, 2018 15:26
Rimworld output log published using HugsLib
Log uploaded on Monday, October 22, 2018, 8:25:56 AM
Loaded mods:
Core: (no assemblies)
HugsLib[6.0.1]: 0Harmony(1.2.0.1), HugsLib(1.0.0.0)
Miscellaneous 'CORE': ColonistKeys(0.19.0.0), CommonMisc(0.19.0.0)
JecsTools: 0Harmony(1.0.9.1), 0JecsTools(1.0.8.0), AbilityUser(1.18.0.0), AbilityUserAI(1.18.0.0), CompActivatableEffect(1.18.0.0), CompAnimated(1.18.0.0), CompBalloon(1.18.0.0), CompDeflector(1.18.0.0), CompDelayedSpawner(1.18.0.0), CompExtraSounds(1.18.0.0), CompInstalledPart(1.18.0.0), CompLumbering(1.18.0.0), CompOverlays(1.18.0.0), CompOversizedWeapon(1.18.0.0), CompSlotLoadable(1.18.0.0), CompToggleDef(1.18.0.0), CompVehicle(1.17.0.1), PawnShields(1.0.0.0)
Mod Manager: 0ColourPicker(1.0.0.0), 0Harmony(1.2.0.1), ModManager(1.0.0.0)
ModSync RW - 1.0: 0Harmony(1.2.0.1), ModSyncRW(1.0.0.0)
Glitter Tech: (no assemblies)
A Dog Said...: (no assemblies)
@kukiron
kukiron / github-dark-script.user.js
Created August 14, 2017 22:48
Dark theme script for GitHub using TamperMonkey
// ==UserScript==
// @name GitHub Dark Script
// @version 2.2.5
// @description GitHub Dark in userscript form, with a settings panel
// @license MIT
// @author StylishThemes
// @namespace https://github.com/StylishThemes
// @include /^https?://((gist|guides|help|raw|status|developer)\.)?github\.com((?!generated_pages\/preview).)*$/
// @include /^https://*.githubusercontent.com/*$/
// @run-at document-start
@Zhentar
Zhentar / patchoperation.md
Last active June 1, 2024 05:31
Introduction to PatchOperation

There are 11 new "PatchOperation" actions we can perform to modify Defs without copying the whole thing. This in turn improves mod compatability dramatically - it allows two mods to modify different parts of the same Def without conflict. This guide only describes the basics of each operation available to us.

Patches go in xml files in a subfolder named "Patches" in your mod folder (So "MyMod\Patches", just like you might have "MyMod\Defs" or "MyMod\Textures"). Example.

Each PatchOperation has an "xpath" node, which should contain an xpath selector for the xml node(s) that the operation should affect. This is not an xpath tutorial. If you don't know xpath, not my problem. But minimurgle has you covered!

To illustrate the operations, I'll use this simple example def:

  <DesignationCategoryDef>
@fearthecowboy
fearthecowboy / Test.csproj
Last active February 13, 2025 07:40
The definitive way to use PowerShell from an msbuild script
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- #1 Place this line at the top of any msbuild script (ie, csproj, etc) -->
<PropertyGroup><PowerShell># 2>nul || type %~df0|find /v "setlocal"|find /v "errorlevel"|powershell.exe -noninteractive -&amp; exit %errorlevel% || #</PowerShell></PropertyGroup>
<!-- #2 in any target you want to run a script -->
<Target Name="default" >
<PropertyGroup> <!-- #3 prefix your powershell script with the $(PowerShell) variable, then code as normal! -->
<myscript>$(PowerShell)
@Tithen-Firion
Tithen-Firion / minified version for bookmarklet
Last active August 25, 2018 21:35
Steam long images fixer. Adds minimal height to long images uploaded with fake resolution
javascript:(function(){var%20a=document.createElement("style");a.innerHTML=".publishedfile_popup_screenshot,.publishedfile_popup_screenshot>img,.profile_media_item,.imgWallItem{min-height:100px}",document.head.appendChild(a),[].forEach.call(document.getElementsByTagName("iframe"),function(e){e.contentDocument.head.appendChild(a.cloneNode(true))})})();
@Tithen-Firion
Tithen-Firion / minified version for bookmarklet
Last active April 21, 2021 07:46
Steam background cropper. Crops showcase and avatar images from background. Works on background image url.
javascript:(function(){function%20a(a){var%20b=document.createElement("script");b.onload=function(){++d},b.src=a,document.body.appendChild(b)}function%20b(){2==d&&(window.clearInterval(e),c())}function%20c(){var%20a,b,c=document.createElement("canvas"),d=new%20JSZip,e=new%20Image,f=c.getContext("2d"),g=function(a,b,d,g){c.width=d,c.height=g,f.drawImage(e,a,b,d,g,0,0,d,g);var%20h=c.toDataURL("image/png");return%20h.substr(h.indexOf(",")+1)},h=function(a,b,c,e,f){d.file(a,g(b,c,e,f),{base64:!0})},i=function(){d.generateAsync({type:"blob"}).then(function(a){saveAs(a,"Steam-cropped-background.zip")})},j=function(){h(l+"avatar.png",b-461,34,164,164),h(l+"artwork_big.png",b-452,271,506,a-271),h(l+"artwork_small.png",b+62,271,100,a-271),i()},k=window.location.pathname.split("/"),l=k.length>1?k[k.length-2]+"_":"";e.onload=function(){b=Math.ceil(this.naturalWidth/2),a=this.naturalHeight,j()},e.src=document.location.href}window.location.host.indexOf("akamaihd.net")>-1&&(alert("try%20again%20now"),window.location="http: