Skip to content

Instantly share code, notes, and snippets.

@mmichlin66
mmichlin66 / virtualizing-problem.ts
Last active October 15, 2020 02:00
Virtualizing TypeScript Properties with Proxy and Decorator - listing 1
class Base
{
first = { v: 1 };
second = this.first;
}
class Derived extends Base
{
first = { v: 2 };
}
@sidneys
sidneys / gfycat.show-all-download-links.js
Last active September 21, 2022 05:45
UserScript | GFYCAT | Show all Download Links (GIF, MP4, WEBP, WEBM)
@daehahn
daehahn / wsl2-network.ps1
Last active April 21, 2025 03:30
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@toonech
toonech / godot_accessor.ps1
Created July 31, 2020 20:23
PowerShell function to generate field and accessors for gdscript (Godot Game Engine), inspired by Bitwes bash script for Mac
function New-GdAccessor{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true, Position=1, ParameterSetName="Set1")]
[Parameter(Mandatory=$true, Position=1, ParameterSetName="Set2")]
[ValidatePattern('^_[a-zA-Z0-9]+$')]
[string] $Backing,
[Parameter(Mandatory=$true, Position=2, ParameterSetName="Set2")]
$InitialValue,
[Parameter()]
@olets
olets / zsh-plugin-manager-plugin-installation-procedures.md
Last active March 23, 2025 01:00
zsh plugin manager cross-reference

Instructions for installing zsh plugins, for a variety of plugin managers

@JustinGrote
JustinGrote / PSAnywhere.md
Last active September 21, 2022 09:34
Powershell Debug Anywhere Design

CURRENT (5.1+ Compatibility)

  1. Main process starts the bootstrap script (e.g. iwr git.io/PSAnywhere | iex)
  2. Monitor for the process going into debugging state with a "sidecar" runspace that will watch the availability event for debug status
  3. When a process goes into debug, write to the main host that debug was detected and sidecar is starting
  4. Spawn a new namedpipe client that attaches to the relevant process' autogenerated named pipe
  5. Start a new instance of the golang ssh server and redirect stdio to the named pipe. The golang ssh server will have a powershell subsystem that simply interacts with stdin/out EDIT: Investigating using https://github.com/intothevoid/sshserver instead of sshdog
  6. [Optional] Expose the ssh port via rendevous service (Use gonnel/azure relay/websocat/inlets/whatever)
  7. You should now be able to enter-pssession -hostname -port <custom server port, will default to 22222> from the client and then debug-runspace (id) to debug the process.

This will work in

@Jaykul
Jaykul / Where-Object.ps1
Last active January 25, 2021 08:02
A better, but slower, where (supports leaving off the property name)
function Where-MyObject {
[CmdletBinding(DefaultParameterSetName = 'ScriptBlockSet', HelpUri = 'http://go.microsoft.com/fwlink/?LinkID=113423', RemotingCapability = 'None')]
param(
[Parameter(ValueFromPipeline=$true)]
[psobject]
${InputObject},
[Switch]
${Not},
@sillyslux
sillyslux / userContent.css
Created July 7, 2020 15:11
firefox theme file to follow system theme in devtools
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* IMPORTANT NOTE
* This file is parsed in js (see client/shared/theme.js)
* so the formatting should be consistent (i.e. no '}' inside a rule).
*/
abstract class Callable {
call() {
console.log("Call!")
}
}
abstract class Activable {
active: boolean = false
activate() {
this.active = true
@onlurking
onlurking / programming-as-theory-building.md
Last active May 6, 2025 06:16
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct