Skip to content

Instantly share code, notes, and snippets.

View dfinke's full-sized avatar

Doug Finke dfinke

View GitHub Profile
@dfinke
dfinke / tryProfiler.ps1
Created February 17, 2022 00:50
Try PS Profiler and show results in Excel
# Install-Module -Name Profiler
# created by: @nohwnd - twitter - Jakub Jareš
$trace = Trace-Script {
Get-Process |
Select-Object -First 5 Company,Name,handles |
Export-Excel ./tempProfiler.xlsx
}
Remove-Item ./tempProfiler.xlsx -ErrorAction SilentlyContinue
$data = ConvertFrom-Csv @"
Region,State,Units,Price
West,Texas,927,923.71
North,Tennessee,466,770.67
East,Florida,520,458.68
East,Maine,828,661.24
West,Virginia,465,053.58
North,Missouri,436,235.67
South,Kansas,214,992.47
North,North Dakota,789,640.72
function squeeze {
param($s)
$p = $s.IndexOf(' ')
while ($p -gt -1) {
$s = $s -replace ' ', ' '
$p = $s.IndexOf(' ')
}
function add ($a, $b) {
$a + $b
}
function subtract ($a, $b) {
$a - $b
}
$a, $b = 4, 5
function add ($a, $b) {
$a + $b
}
function subtract ($a, $b) {
$a - $b
}
$a, $b = 4, 5
@dfinke
dfinke / melt.ipynb
Last active October 17, 2021 13:15
melt.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dfinke
dfinke / Get-GCD.ps1
Last active September 27, 2021 23:58
Finding the Greatest Common Divisors with PowerShell, using the modulo operator, multiple assignments, and a hash table for results.
# greatest common divisor
function Get-GCD {
param(
[int]$a,
[int]$b
)
$r = [ordered]@{a = $a; b = $b }
while ($a -ne 0) {
# Set up the constants:
$ObjectPronouns = 'Her', 'Him', 'Them'
$PossesivePronouns = 'Her', 'His', 'Their'
$PersonalPronouns = 'She', 'He', 'They'
$States = 'California', 'Texas', 'Florida', 'New York', 'Pennsylvania', 'Illinois', 'Ohio', 'Georgia', 'North Carolina', 'Michigan'
$Nouns = 'Athlete', 'Clown', 'Shovel', 'Paleo Diet', 'Doctor', 'Parent', 'Cat', 'Dog', 'Chicken', 'Robot', 'Video Game', 'Avocado', 'Plastic Straw', 'Serial Killer', 'Telephone Psychic'
$Places = 'House', 'Attic', 'Bank Deposit Box', 'School', 'Basement', 'Workplace', 'Donut Shop', 'Apocalypse Bunker'
$When = 'Soon', 'This Year', 'Later Today', 'RIGHT NOW', 'Next Week'
function generateAreMillennialsKillingHeadline {
{
"commandline": "docker run -it --rm mcr.microsoft.com/azure-powershell:latest",
"guid": "{9f050a18-cc35-4d39-83b1-104749e7e3f8}",
"icon": "ms-appx://ProfileIcons/{b453ae62-4e3d-5e58b989-0a998ec441b8}.png",
"name": "Azure PowerShell (Docker)",
"startingDirectory": "%USERPROFILE%",
"tabTitle": "Azure PowerShell (Docker)"
}

Say Hello

print("Hello World")
x = 1
print(x)