Skip to content

Instantly share code, notes, and snippets.

View anonhostpi's full-sized avatar
📝
Studying...

Blue Falcon anonhostpi

📝
Studying...
View GitHub Profile
@anonhostpi
anonhostpi / wasm.ps1
Last active September 14, 2025 08:42
How to do wasm in powershell
# iex (iwr 'https://gist.githubusercontent.com/anonhostpi/e33c2fb4e3282ff75962cf12a2a9af6a/raw/wasm.ps1').content
& {
# Install-Package "Wasmtime" -ProviderName NuGet
$package = Get-Package -Name "Wasmtime"
$directory = $package.Source | Split-Path
$runtime = "win-x64" # "win/linux/osx-arm64/x64"
@anonhostpi
anonhostpi / cloud-init.yaml
Last active September 8, 2025 00:41
Archive-Wasm builder for Wasmtime
# $init = path/to/cloud-init.yaml
# # (iwr "https://gist.githubusercontent.com/anonhostpi/05aa300aa56a3b1baf19561b3bc607f5/raw/cloud-init.yaml").Content | Out-File $init
#
# multipass launch --name archive-wasm --memory 6G --disk 20G --cloud-init $init --network "<your-network-adapter>"
# multipass mount "$(Resolve-Path . <# or wherever #>)" archive-wasm:/home/ubuntu/shared
# multipass stop archive-wasm
# multipass start archive-wasm
# multipass shell archive-wasm
#
# # Inside the VM:
@anonhostpi
anonhostpi / wasm.ps1
Last active September 5, 2025 02:25
Wasm in PowerShell
# iex (iwr 'https://gist.githubusercontent.com/anonhostpi/c82d294d7999d875c820e3b2094998e9/raw/wasm.ps1').Content
$engine = & {
$package = "Wasmtime"
$runtime = & (nmo {iex "using namespace System.Runtime.InteropServices" }) {
$runtime = @{}
$is = { param([OSPlatform] $platform); return ([RuntimeInformation]::IsOSPlatform($platform)) }
@anonhostpi
anonhostpi / webserver.ps1
Last active September 1, 2025 10:05
Webserver Example
# iex (iwr "https://gist.githubusercontent.com/anonhostpi/1cc0084b959a9ea9e97dca9dce414e1f/raw/webserver.ps1").Content
function New-Webserver {
param(
[string] $Binding = "http://localhost:8080/",
[string] $BaseDirectory = "$(Get-Location -PSProvider FileSystem)",
[string] $Name = "PowerShell Web Server",
[System.Collections.IDictionary] $Routes = @{
Before = { param( $Server, $Command, $Listener, $Context ) return $true }
@anonhostpi
anonhostpi / 11112.dat
Created August 27, 2025 16:23
Chima Croc Fly Wheel Cover
0 TOP SHELL, NO. 3 Ø4,85 (Needs Work)
0 Name: 11112.dat
0 Author: <AuthorRealName> [<AuthorLDrawName>]
0 !LDRAW_ORG Unofficial_Part
0 !LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt
0 BFC CERTIFY CCW
0 !HISTORY 2013-08-14 {LEGO Digital Designer} Original part shape
0 !HISTORY 2013-08-14 [<AuthorLDrawName>] File preparation for LDraw Parts Tracker
@anonhostpi
anonhostpi / temp-ironpython.ps1
Last active July 8, 2025 16:53
Setup Temp IronPython
# See https://github.com/IronLanguages/ironpython3/pull/1957#discussion_r2187237475
& {
$ironpython = 'https://raw.githubusercontent.com/IronLanguages/ironpython3/main/eng/scripts/Install-IronPython.ps1'
$returns = @{ path = "$env:TEMP\$([guid]::NewGuid().ToString())" }
& {
"Installing IronPython to temp ('$($returns.path)')..."
& ([scriptblock]::Create((iwr `
@anonhostpi
anonhostpi / python.ps1
Created July 2, 2025 02:07
Embedding IronPython Demo
$url = 'https://raw.githubusercontent.com/anonhostpi/ironpython3/iex-web-support/eng/scripts/Install-IronPython.ps1'
iex ((New-Object System.Net.WebClient).DownloadString($url))
Import-Module ".\IronPython.dll"
& {
[IronPython.Hosting.Python]::CreateEngine().
CreateScriptSourceFromString("print('Hello from embedded IronPython!')").
Execute()
}
@anonhostpi
anonhostpi / simgeom.ksy
Created September 7, 2024 16:06
A Kaitai Struct for DBPF Geom Entries
meta:
id: geom
file-extension: geom
endian: le
imports:
- path/to/mtnf.ksy
seq:
- id: header
type: header
- id: shader
@anonhostpi
anonhostpi / FrocedPromise.ts
Created August 27, 2024 13:30
A TypeScript file for writing a promise that is forced non-blocking using setTimeout
/*
async functions and promises can be a bit misleading, as they are not guaranteed to be executed asynchronously.
The way these work is by deferring the execution of a portion of the code to another tick of the event loop.
For async functions, the code is executed synchronously until the first await statement,
at which point the function is suspended and the rest of the code is executed
asynchronously on another tick when the awaited promise is resolved.
For promises, the executor function is executed immediately, but in
which tick the promise is resolved can be more granularly controlled.
@anonhostpi
anonhostpi / clearscript_playground.ps1
Created June 19, 2024 08:03
A Playground in PowerShell for Messing With ClearScript
# Install-Module Import-Package
# Install-Module New-ThreadController
Write-Host "Preparing Test Environment:"
Write-Host " - Imports:"
Write-Host " - Import-Package: " -NoNewline
Try {
Import-Module "Import-Package"
Write-Host " " -NoNewline