Skip to content

Instantly share code, notes, and snippets.

View philipmat's full-sized avatar

Philip Mateescu philipmat

View GitHub Profile
philipmat / Program.cs
Last active October 10, 2023 18:22
DotNet LongTimePattern
Console.WriteLine($".NET Version={Environment.Version}");
Console.WriteLine($"Long Time Pattern={new System.Globalization.CultureInfo("en-US").DateTimeFormat.LongTimePattern}");
// This file was initially generated by Windows Terminal 1.1.2233.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see:
"$schema": "",
philipmat / FindFileLockingProcess.ps1
Created July 2, 2021 13:04
Finds process that locks a given file
[Parameter(Position=1, Mandatory = $true)] # Position = 1 allow passing without specifying -FileOrFolderPath
[String] $FileOrFolderPath
If((Test-Path -Path $FileOrFolderPath) -eq $false) {
Write-Warning "File or directory does not exist."
Else {
philipmat / DetermineNetframeworkVersion.ps1
Created July 2, 2021 13:03
Lists all available .NET Framework versions
The sample scripts are not supported under any Microsoft standard support
program or service. The sample scripts are provided AS IS without warranty
of any kind. Microsoft further disclaims all implied warranties including,
without limitation, any implied warranties of merchantability or of fitness for
a particular purpose. The entire risk arising out of the use or performance of
the sample scripts and documentation remains with you. In no event shall
Microsoft, its authors, or anyone else involved in the creation, production, or
delivery of the scripts be liable for any damages whatsoever (including,
without limitation, damages for loss of business profits, business interruption,
philipmat / IAmUpResponder.cs
Created September 11, 2020 14:43
Socket responder - Listens on a socket for incoming connections and responds with "I Am Up" html.
void Main()
/// <summary>
/// Listens on a socket for incoming connections and responds with "I Am Up" html.
/// </summary>
/// <remarks>
/// Inspired by:
philipmat / HttpListener.cs
Created September 11, 2020 14:41
HTTP Listener - creates a netcat-like listener on a local port. Returns 201 to all requests
void Main() {
var cts = new CancellationTokenSource();
var task = StartListener(cts.Token);
do {
} while (true);
philipmat / Create LocalDB Databases.linq
Created September 11, 2020 14:32
Create or Attach SQL Database (for LocalDB) - LINQPad script
<Query Kind="Statements">
// Example:
philipmat / console.log
Created February 15, 2019 22:41
Visual Studio Code macOS freeze
[main 2019-02-15T22:37:18.094Z] Starting VS Code
[main 2019-02-15T22:37:18.095Z] from: /Users/af59986/Applications/Visual Studio
[main 2019-02-15T22:37:18.095Z] args: { _: [],
diff: false,
add: false,
goto: false,
'new-window': false,
'reuse-window': false,
wait: false,
version: false,
philipmat / say.ps1
Last active December 9, 2018 00:51
say command in Powershell
[Parameter(Position = 1, Mandatory = $true)]
Add-Type -AssemblyName System.Speech
$synth = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
philipmat / ilog.snippet
Created February 22, 2018 13:56
Code Snippets for C#
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="">
<CodeSnippet Format="1.0.0">
<Description>Generates a private field to hold a Common.Logging.ILog</Description>
<Author>Philip Mateescu</Author>