Skip to content

Instantly share code, notes, and snippets.

View jessitron's full-sized avatar
🚀
"I'm in"

Jessica Kerr jessitron

🚀
"I'm in"
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
@iainjreid
iainjreid / package-json.d.ts
Last active February 13, 2020 20:28
A Typescript type definition for NPM package files
export interface IPackageJSON extends Object {
readonly name: string;
readonly version?: string;
readonly description?: string;
readonly keywords?: string[];
@pithyless
pithyless / either.rb
Created March 27, 2012 14:44
Chaining Either for Ruby
# A chainable Either monad for Ruby
#
# Examples
#
# Either.right('s') >> proc { |s| Either.right(s + '-1') } >> proc { |s| Either.right(s + '-2') }
# #=> #<Either @left=nil, @right="s-1-2">
#
# Either.right('s') >> proc { |s| Either.left('error!') } >> proc { |s| Either.right(s + '-2') }
# #=> #<Either @left='error!', @right=nil>
#