Skip to content

Instantly share code, notes, and snippets.

View dfinke's full-sized avatar

Doug Finke dfinke

View GitHub Profile
$AzureConn = Get-AutomationConnection -Name 'AssetConnectionName'
$Certificate = Get-AutomationCertificate -Name $AzureConn.AutomationCertificateName
Set-AzureSubscription -SubscriptionName 'AssetConnectionName' -SubscriptionId $AzureConn.SubscriptionID -Certificate $Certificate
Select-AzureSubscription -SubscriptionName 'AssetConnectionName'
@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=@()}
}
#################################### BEGIN ##############################################
$Title = "My Doc"
$lab = {
########## Module
###### Task - Set an alias
#### Description
## Set an alias using Set-Alias and test it.
### Example:
// LogAnalytics function to query a performance counter (CounterName), in computer, starting on date Sart for a 30d period
// Copy paste the query in LogAnalytics window
// Define custom Loganalytics function
let PerfCountWithin30dRange = (start:date, CounterName:string, CompName:string) {
let period = 30d;
Perf
| where (TimeGenerated > start and TimeGenerated < start + period)
| where (Computer contains CompName)
@TylerLeonhardt
TylerLeonhardt / TweetScript.psm1
Last active July 17, 2018 19:37
Importing Scripts from Tweets! #280characters
# Importing Scripts directly from Tweets! #280characters
#
# NOTE: This should not be used for any production environment. Or any environment for that matter. Use https://PowerShellGallery.com
#
#
####################################
# Example #
####################################
#
#
@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"
}
@sunnyc7
sunnyc7 / ReadingAndOtherConsumption.md
Last active February 7, 2019 01:55
Current List of Consummables.

Reading, Video and Audio List

Software

  • Ousterhout, John - A Philosophy of Software Design. Amazon
  • Zinsser, William - On Writing Well: The Classic Guide to Writing Nonfiction On Writing Well Amazon
  • Stephen Orban - Ahead in the Cloud: Best Practices for Navigating the Future of Enterprise IT (Kindle Books) Amazon

Management

  • Grove, Andy. High Output Management. Amazon
  • Forsgren PhD, Nicole, Humble, Jez, Kim, Gene - Accelerate: The Science of Lean Software and DevOps: Building and Scaling High Performing Technology Organizations [Amazon](https://www.amazon.com/Accelerate-Softw
@joeduffy
joeduffy / Pulumi.yaml
Last active October 20, 2019 22:35
A serverless website with dynamic hit counter on Azure
name: page-counter-az
runtime: nodejs
description: A page counter on Azure
@SQLvariant
SQLvariant / ExportPBIServiceAssets-toCSV.PS1
Created September 20, 2019 15:40
Export information about Power BI tenant assets to Excel or CSV files
<##################################################################################################>
<#
Export information about assets in the Power BI Tenant to individual CSV files.
#>
<##################################################################################################>
<#
NOTE: You have to be a Power BI Admin to use the -Scope Organization parameter option. #>
<# First, get all the capacities for the tenant, if they have any #>
Get-PowerBICapacity -Scope Organization |
@SQLvariant
SQLvariant / Split_SQL_Files.ps1
Last active July 28, 2020 18:02
Simple PowerShell script to break apart comment blocks from code blocks, of a .SQL file
$Path = 'c:\temp\sys_databases.sql'
$s = Get-Content -Raw ( Resolve-Path $Path )
#$s.GetType()
<# Doug's code for extracting the comment blocks. #>
$locations=@()
$pos=$s.IndexOf("/*")
while ($pos -ge 0) {