Skip to content

Instantly share code, notes, and snippets.

View IanYates's full-sized avatar

Ian Yates IanYates

View GitHub Profile
@danvy
danvy / WSL2-Net-Fix.ps1
Created September 5, 2020 21:04
Reset your WSL network connection trying to fix WSL2 media disconnected error
# Check these threads before proceeding:
# https://github.com/microsoft/WSL/discussions/5857
# https://github.com/microsoft/WSL/issues/5821
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
$CmdLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CmdLine
Exit
}
# Restart the Host Network Service
Restart-Service -Force -Name hns
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active May 8, 2024 07:24
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
namespace WebApplication1
{
public class Program
{
public static void Main(string[] args)
@ayende
ayende / LetsEncryptClient.cs
Created January 11, 2018 22:26
ACME v2 client for Let's Encrypt
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@anthonyeden
anthonyeden / ExchangeInstallLE.bat
Created December 23, 2017 03:03
Let's Encrypt & Microsoft Exchange - Installation Script
"C:\Program Files\Lets Encrypt\letsencrypt.exe" --renew --baseuri "https://acme-v01.api.letsencrypt.org/"
powershell -File "C:\Program Files\Lets Encrypt\ExchangeLetsEncrypt.ps1" -CertificateImport "C:\ProgramData\letsencrypt-win-simple\httpsacme-v01.api.letsencrypt.org\mail.example.com-all.pfx" -ServerName exchange.example.com
@adufilie
adufilie / memoize.ts
Last active January 9, 2018 06:35
Decorator for creating memoized versions of functions in TypeScript
/**
* @author adufilie http://github.com/adufilie
*/
let UNDEFINED = {} as any;
type AnyFunction = (...args:any[])=>any;
function isPrimitive(value:any):boolean
{
@odinserj
odinserj / MutexAttribute.cs
Last active January 15, 2022 12:56
MutexAttribute.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Hangfire.Common;
using Hangfire.States;
using Hangfire.Storage;
namespace Hangfire.Pro
{
/// <summary>
@42degrees
42degrees / sso_login_freshdesk.cs
Last active December 27, 2018 21:59 — forked from darkpssngr/sso_login_freshdesk.cs
SSO Login for Freshdesk support portal - ASP.Net C# Sample Code
/// <summary>
/// Handles the display of having successfully logged out of Freshdesk. There
/// are no other side-effects.
/// </summary>
public ActionResult FreshdeskLogout()
{
return View();
}
/// <summary>
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@cryo-warden
cryo-warden / knockout-projection-inversion.js
Created March 1, 2016 10:15
Adds two-way array-binding methods to Knockout v3.0.0beta. Updates may be needed to use this with more modern versions of Knockout.
var log = function () {
if (false && window.DEVMODE) {
return console.log.apply(console, arguments);
}
};
var mapArrayChanges =
ko.utils.mapArrayChanges = function (sourceObs, targetObs, fn, handlerState) {
return sourceObs.subscribe(function (events) {
if (handlerState.busy) { return; }