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
<# | |
.SYNOPSIS | |
This Powershell function gets information about the monitors attached to any computer. It uses EDID information provided by WMI. If this value is not specified it pulls the monitors of the computer that the script is being run on. | |
.DESCRIPTION | |
The function begins by looping through each computer specified. For each computer it gets a litst of monitors. | |
It then gets all of the necessary data from each monitor object and converts and cleans the data and places it in a custom PSObject. It then adds | |
the data to an array. At the end the array is displayed. |
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
# Based on the steps listed here: https://github.com/docker/for-win/issues/6822#issuecomment-643563276 | |
gsv com.docker.service | spsv | |
wsl --shutdown | |
$ubuntu = (Get-AppPackage *Ubuntu20.04*) | |
$fam = $ubuntu.PackageFamilyName | |
explorer "shell:AppsFolder\$fam!ubuntu2004" |
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
// Project Euler 14, but in JS (longest Collatz chain for starting n < 1e6) | |
// Take a cup of ☕, this is going to take a while... (because it's slow) | |
function* collatzSeq(n) { | |
yield n; | |
if (n<=1) return; | |
yield* collatzSeq(n%2==0 ? n/2 : 3*n+1); | |
} | |
function seqLength(s) { |
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
{-# LANGUAGE LambdaCase #-} | |
import Data.List (unfoldr) | |
both :: (a -> b) -> (a,a) -> (b,b) | |
both f (x,y) = (f x, f y) | |
withPrevious :: [a] -> [(a, Maybe a)] | |
withPrevious xs = zip xs (Nothing : map Just xs) |
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
@ECHO OFF | |
set VCPKGROOT=%~dp0 | |
echo VCPKGROOT=%VCPKGROOT% | |
set TOOLCHAIN=%VCPKGROOT%scripts\buildsystems\vcpkg.cmake | |
echo TOOLCHAIN=%TOOLCHAIN% | |
FOR /D %%F IN (%VCPKGROOT%\downloads\cmake-*) DO ( | |
set CMAKEDIR=%%F\bin | |
goto break | |
) |
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: https://blogs.technet.microsoft.com/heyscriptingguy/2015/08/19/parsing-netstat-information-with-powershell-5/ | |
function ns { | |
return (netstat -ano).trim() | select -Skip 4 | ConvertFrom-String -PropertyNames Protocol,LocalAddress,RemoteAddress,State,Process | |
} |
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
// https://github.com/coapp/coapp.powershell/issues/112 | |
configurations { | |
Toolset { | |
key : "PlatformToolset"; | |
choices: { v141 }; | |
v141.condition = "( $(PlatformToolset.ToLower().IndexOf('v141')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' )"; | |
}; | |
} |
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
# https://en.wikipedia.org/wiki/Necklace_%28combinatorics%29#Number_of_necklaces | |
from eulerlib import Divisors | |
def N(k, n): | |
divs = Divisors() | |
return sum( divs.phi(d) * k**(float(n)/d) for d in divs.divisors(n) ) / float(n) | |
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
using System; | |
using System.Collections.Generic; | |
namespace Utilities | |
{ | |
public class ThrottleManager | |
{ | |
static Dictionary<object, DateTime> disabledUntil = new Dictionary<object, DateTime>(); | |
public static bool Throttle(object key, int delay) |
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
; AutoHotkey script for adding shortcuts for volume and next/prev controls | |
; using the Win (#), shift (+) and PgUp/PgDn keys: | |
#PgUp::Send {Volume_Up 3} | |
#PgDn::Send {Volume_Down 3} | |
#+PgDn::Send {Media_Next} | |
#+PgUp::Send {Media_Prev} |
NewerOlder