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
Last active July 28, 2024 04:05
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@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 May 26, 2024 00:56
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)
@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 April 18, 2024 23:37
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:
@Tithen-Firion
Tithen-Firion / minified version for bookmarklet
Last active August 17, 2017 23:10
Steam showcase uploader. Upload long artworks/screenshots on "edit profile" page directly to showcase by choosing file or with drag and drop.
javascript:(function(){function%20a(a){if(!a.firstElementChild.hasAttribute("data-initiated")){a.firstElementChild.setAttribute("data-initiated",1);var%20b=a.getAttribute("data-eshowcasetype");[].forEach.call(a.querySelectorAll(".screenshot_showcase_primary,%20.screenshot_showcase_smallscreenshot.showcase_slot"),function(a){a.setAttribute("data-eshowcasetype",b),0==a.clientHeight&&(a.style.minHeight="300px"),a.addEventListener("click",c,!0),a.addEventListener("dragover",d,!0),a.addEventListener("dragleave",e,!1),a.addEventListener("drop",e,!0),a.classList.contains("openslot")||a.classList.add("not-open")})}}function%20b(b,c){var%20d=b[0].target;a(d)}function%20c(a){a.preventDefault(),a.stopPropagation(),k.parentNode&&k.parentNode.removeChild(k),k.target=this,k.click()}function%20d(a){k.parentNode!==this&&(k.target=this,this.insertBefore(k,this.firstChild)),this.classList.add("dragover")}function%20e(a){this.classList.remove("dragover")}function%20f(){this.parentNode&&this.parentNode.removeChild(this);var%20a=