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
# Copyright (c) 2011 Justin Dearing <zippy1981@gmail.com> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included in |
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
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html | |
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms") | |
$file = (get-item 'C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg') | |
#$file = (get-item "c:\image.jpg") | |
$img = [System.Drawing.Image]::Fromfile($file); | |
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274 |
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 Loosely on this VB script using a commercial ActiveX object to interrogate the registry. | |
# http://www.motobit.com/help/regedit/sa117.htm | |
Get-ChildItem HKLM:\SOFTWARE\Classes\CLSID | ForEach-Object { | |
$regKey = $_; | |
if ($regKey.GetValue('OLEDB_SERVICES') -ne $null -and $regKey.OpenSubKey("OLE DB Provider") -ne $null) { | |
New-Object PSObject -Property @{ | |
'Key' = $regKey.GetValue(""); | |
'OLEDBProvider' = $regKey.OpenSubKey("OLE DB Provider").GetValue(""); | |
}; | |
} |
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
/* | |
SOS | |
Sends SOS in morse code on the Arduino board. | |
For more information see http://en.wikipedia.org/wiki/Morse_code | |
Copyright 2012 Justin Dearing. | |
*/ | |
int dotDur = 125; | |
int dashDur = dotDur * 3; |
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
# Get original data | |
$data = @{ | |
First = 'Justin'; | |
Last = 'Dearing'; | |
Resume = @{ | |
Experience = [HashTable[]]@( | |
@{ | |
StartDate = [DateTime] (Get-Date '2002-03-23'); | |
EndDate = [DateTime] (Get-Date '2007-05-15'); | |
Company = 'ACME ISP'; |
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
# We assume that the driver is installed via the MSI. | |
[string] $mongoDriverPath; | |
# Check to see if we are running the 64 bit version of Powershell. | |
# See http://stackoverflow.com/questions/2897569/visual-studio-deployment-project-error-when-writing-to-registry | |
if ([intptr]::size -eq 8) { | |
$mongoDriverPath = (Get-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx\MongoDB CSharpDriver 1.0").'(default)'; | |
} | |
else { | |
$mongoDriverPath = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx\MongoDB CSharpDriver 1.0").'(default)'; |
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
/* | |
* | |
* Copyright (c) 2011 Justin Dearing (zippy1981@gmail.com) | |
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) | |
* and GPL (http://www.opensource.org/licenses/gpl-license.php) version 2 licenses. | |
* This software is not distributed under version 3 or later of the GPL. | |
* | |
* Version 1.0.0-RC1 | |
* | |
*/ |
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
function Get-ComNameByAppId { | |
param ( | |
[Guid] $AppId | |
) | |
(get-wmiobject -class "Win32_DCOMApplication" -namespace "root\CIMV2" -Filter "AppID = '{$AppId}'").Name | |
} | |
Get-EventLog -EntryType Error -LogName System |Where EventID -eq 10016 | % { | |
$ReplamentStringLength = $_.ReplacementStrings.Length; | |
$ClassId = $null; |
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
public static IApplicationBuilder UseCorrelationProperties(this IApplicationBuilder app) | |
{ | |
return app.Use(async (context, next) => | |
{ | |
var logger = context.RequestServices.GetRequiredService<ILogger<CorrelationProperties>>(); | |
// NOTE: We're using Features and not RequestServices here. | |
var requestTelemetry = context.Features.Get<RequestTelemetry>(); | |
if (requestTelemetry != null) | |
{ |
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
*~ |
NewerOlder