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 Deploy-AzureFunction( | |
[Parameter(Mandatory = $true)] | |
[String]$username, | |
[Parameter(Mandatory = $true)] | |
[String]$password, | |
[Parameter(Mandatory = $true)] | |
[String]$functionAppName, | |
[Parameter(Mandatory = $true)] | |
[String]$zipFilePath | |
) |
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
#Which process was taking up a lot of processing resource over the last two hours in a specific machine? | |
#(don't be surprised if it is more that 100% because it can be a multi-core machine) | |
let startTime=ago(2hour) | |
let ednTime=now() | |
Perf | |
| where TimeGenerated between (startTime..endTime) and Computer == "(Contoso.Retail.com)" and ObjectName == "Process" and InstanceName !in ("_Total", "idle") | |
| make-series avg(CounterValue) default=0 on TimeGenerated in range(startTime, endTime, 10m) by InstanceName | |
| mvexpand TimeGenerated to typeof(datetime), avg_CounterValue to typeof(double) limit 100000 | |
| render timechart |
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 class Text | |
{ | |
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |
private static bool IsWhiteSpace(char ch) | |
{ | |
// this is surprisingly faster than the equivalent if statement | |
switch (ch) | |
{ | |
case '\u0009': | |
case '\u000A': |
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 class StringCompressor { | |
readonly string _value; | |
public void StringCompressor(string value) | |
{ | |
_value = value; | |
} | |
public MemoryStream ToCompressedStream1(CompressionLevel level) | |
{ |
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
[Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") | Out-Null | |
[System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish | |
$publish.GacInstall(<<FullFilePathToTheDll>>) |
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 Invoke-WebRequestV2 { | |
param ( | |
[Parameter(Mandatory=$true)] | |
[uri] | |
$Uri, | |
[Parameter(Mandatory=$false)] | |
[string] | |
$Method, | |
[Parameter(Mandatory=$false)] | |
[string] |
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
class CachedDataSource | |
{ | |
protected T RetrieveCachedData<T>( | |
string cacheKey, Func<T> fallbackFunction, CacheItemPolicy cachePolicy) where T : class | |
{ | |
var originalData = new CacheItem<Lazy<T>>(new Lazy<T>(fallbackFunction)); | |
var cachedData = (CacheItem<Lazy<T>>)_cacheProvider.AddOrGetExisting(cacheKey, originalData, cachePolicy); | |
if (cachedData != null) | |
{ | |
Logger.LogMessage(SeverityLevels.Verbose, |
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
<View> | |
<Query> | |
<OrderBy> | |
<FieldRef Name="_UIVersionString"/> | |
<FieldRef Name="LinkFileName" /> | |
</OrderBy> | |
<Where> | |
<Or> | |
<Eq> | |
<FieldRef Name="_ModerationStatus"/> |