Skip to content

Instantly share code, notes, and snippets.

View dfinke's full-sized avatar

Doug Finke dfinke

View GitHub Profile
@davidfowl
davidfowl / Examples
Created May 21, 2011 08:19
Powershell function that recursively walks all project items within a project and lets you execute an action on each one
# Print all project items
Recurse-Project -Action {param($item) "`"$($item.ProjectItem.Name)`" is a $($item.Type)" }
# Function to format all documents based on https://gist.github.com/984353
function Format-Document {
param(
[parameter(ValueFromPipelineByPropertyName = $true)]
[string[]]$ProjectName
)
Process {
@altrive
altrive / PowerShellv4_DynamicKeyword.md
Last active August 3, 2023 02:28
Test code of PowerShell v4 Dynamic Keyword

Define DynamicKeyword

Define DynamicKeyword 'ExecTest'

Note: Don't copy&paste from following code. PowerShell SyntaxHighlighter remove some lines. Instead, use RAW view.

#Requires -Version 4.0
Set-StrictMode -Version Latest
@dfinke
dfinke / ExtractSVN.ps1
Created October 12, 2013 16:10
Use PowerShell to extract Subversion commands and the parameters from help to a hash table
$svninfo = @{}
svn help |
?{$_ -match "^ "} |
%{($_.trim() -split " ")[0]} |
%{
$command = $_
if(!$svninfo.ContainsKey($command)) {
$svninfo.$command=@{SingleHyphen=@();DoubleHyphen=@()}
}
@non
non / answer.md
Last active January 9, 2024 22:06
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

$AzureConn = Get-AutomationConnection -Name 'AssetConnectionName'
$Certificate = Get-AutomationCertificate -Name $AzureConn.AutomationCertificateName
Set-AzureSubscription -SubscriptionName 'AssetConnectionName' -SubscriptionId $AzureConn.SubscriptionID -Certificate $Certificate
Select-AzureSubscription -SubscriptionName 'AssetConnectionName'
@CDillinger
CDillinger / FuzzyMatch.cs
Last active July 25, 2023 09:17
C# Implementation of Fuzzy Match
// LICENSE
//
// This software is dual-licensed to the public domain and under the following
// license: you are granted a perpetual, irrevocable license to copy, modify,
// publish, and distribute this file as you see fit.
using System;
using System.Collections.Generic;
public static class FuzzyMatcher
function Show-Object{
param(
## The object to examine
[Parameter(ValueFromPipeline = $true)]
$InputObject
)
#custom controls for treeview... found it on MSDN a while ago, lost link :-/
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
#################################### BEGIN ##############################################
$Title = "My Doc"
$lab = {
########## Module
###### Task - Set an alias
#### Description
## Set an alias using Set-Alias and test it.
### Example:
@daviwil
daviwil / VSCodeDeepDive.md
Created April 13, 2017 13:38
The notes from my session "Authoring in VS Code" at the 2017 PowerShell and DevOps Global Summit in Bellevue, WA.

Visual Studio Code Deep Dive

David Wilson - @daviwil Software Engineer, PowerShell Team

Overview

  1. Visual Studio Code overview
  2. Configuring the editor
  3. Extensions
@adamdriscoll
adamdriscoll / task.json
Created May 15, 2017 11:32
VSCode task.json to add a build command to package a PowerShell script as an exe
{
"version": "0.1.0",
"tasks": [
{
"taskName": "build",
"command": "powershell",
"args": ["Merge-Script -Script '${file}' -Bundle -OutputPath '${fileDirname}\\out' -OutputType Executable"],
"isBuildCommand": true,
"showOutput": "silent"
}