This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
def return_arg(func, /, arg): | |
func(arg) | |
return arg | |
def return_args(func, /, *args): | |
func(*args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from statistics import mean | |
# average win/loss rate of player against other humans/bots (i.e. it is/isn't a bot game) | |
VS_HUMANS_WIN_RATE = 1 / 2 # expected long-run average in a true ELO system | |
VS_HUMANS_LOSE_RATE = 1 - HUMAN_WIN_RATE | |
VS_BOTS_WIN_RATE = 1 # ideal assumption (i.e. unrealistic) | |
VS_BOTS_LOSE_RATE = 1 - BOT_LOSE_RATE | |
# expected change in Master ranking of player against humans/bots after a win/loss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Preference Variable | |
Set-Variable -Name 'OutputEncoding' -Value ([System.Text.Encoding]::UTF8) ` | |
-Scope Global -Option AllScope, ReadOnly -Force -ErrorAction Continue | |
# These commands' Encoding parameter are enumly typed. | |
$global:PSDefaultParameterValues['Add-Content:Encoding'] = [Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding]::UTF8 | |
$global:PSDefaultParameterValues['Get-Content:Encoding'] = [Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding]::UTF8 | |
$global:PSDefaultParameterValues['Set-Content:Encoding'] = [Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding]::UTF8 | |
# These commands' Encoding parameter are stringly typed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! "netcoreapp3.1" | |
#r "nuget: Microsoft.Graph" | |
#r "nuget: Microsoft.Graph.Core" | |
#r "nuget: Microsoft.Graph.Auth" | |
#r "nuget: Microsoft.Identity.Client" | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -Version 6.2 | |
<#PSScriptInfo | |
.VERSION 1.0.0-20200222T0102366618Z | |
.GUID ce06a265-573d-4557-a66b-dfe9fff8d7a1 | |
.AUTHOR Travis.LaGrone@microsoft.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta, tzinfo | |
from dateutil.tz import gettz | |
from uuid import uuid4 | |
from geopy.geocoders import Nominatim | |
from timezonefinder import TimezoneFinder | |
nomi = Nominatim(user_agent=str(uuid4())) | |
tzf = TimezoneFinder() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Types> | |
<Type> | |
<Name>System.Collections.Hashtable</Name> | |
<Members> | |
<ScriptMethod> | |
<Name>AddRange</Name> | |
<Script> | |
[OutputType()] | |
param([hashtable] $other) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
PSDependOptions = @{} | |
#region Interactive | |
# Color | |
'PSColor' = @{ | |
Tags = @( | |
'interactive' | |
'color' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Register-ArgumentCompleter -CommandName 'Get-Help' -ParameterName 'Parameter' -ScriptBlock { | |
[OutputType([System.Management.Automation.CompletionResult])] # zero to many | |
param( | |
[string] $commandName, | |
[string] $parameterName, | |
[string] $wordToComplete, | |
[System.Management.Automation.Language.CommandAst] $commandAst, | |
[System.Collections.IDictionary] $fakeBoundParameters | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NounInfo { | |
[string] $Noun | |
[string[]] $Verbs | |
[System.Management.Automation.PSModuleInfo[]] $Modules | |
[System.Management.Automation.CommandInfo[]] $Commands | |
} | |
Update-TypeData -Force ` | |
-TypeName 'NounInfo' ` | |
-DefaultKeyPropertySet 'Noun' ` |
NewerOlder