This file contains hidden or 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 GetFewObjs() | |
| { | |
| New-Object PSObject -p @{ | |
| Name = "Bill" | |
| Surname = "Gates" | |
| } | |
| New-Object PSObject -p @{ | |
| Name = "Barack" |
This file contains hidden or 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 SelectFrom-Mssql([string] $selectQuery) | |
| { | |
| . sqlcmd -S "(local)" -d `"mydb`" `-Q "SET NOCOUNT ON $selectQuery" -s "|" -W | | |
| ConvertFrom-CSV -Delimiter "|" | | |
| select -skip 1 | |
| } | |
| SelectFrom-Mssql "exec sp_who" |
This file contains hidden or 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-GitRepoPath | |
| { | |
| @( $i=0;` | |
| $pwd.path -split "\\"| ` | |
| %{"$(@($pwd.path -split '\\')[0..$i] -join '\')";$i++} | ` | |
| ? {test-path "$_\\.git"})[0] | |
| } | |
| function Get-GitCurrentBranch | |
| { |
This file contains hidden or 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
| cat build_out.txt | %{switch -regex ($_) {"^err:" {write-host $_ -backgroundcolor "red"} default {write-host $_}}} |
This file contains hidden or 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 Program | |
| { | |
| // PcQueue - demo | |
| // Code copied from "C# 5.0 in a Nutshell: The Definitive Reference" by Joseph Albahari and Ben Albahari | |
| // Modified by @borisbucha to efficiently support IO bound operations (simply adding TaskCreationOptions.LongRunning to consumer tasks) | |
| // which sugests to scheduler to allocate dedicated thread to enqued items instead of poluting Threadpool. | |
| static void Main() | |
| { | |
| Console.WriteLine("press any key when ready"); | |
| Console.ReadLine(); |
This file contains hidden or 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 Program | |
| { | |
| // TaskCreationOptions.LongRunning - demo | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("press any key when ready (run ProccessExplorer 's proccess Threads tab)"); | |
| Console.ReadLine(); | |
| for (int i = 0; i < 1000; i++) | |
| { |
This file contains hidden or 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 Program | |
| { | |
| // BlockingCollection - demo (approaching Q3) | |
| static void Main(string[] args) | |
| { | |
| var coll = new BlockingCollection<string>(); | |
| Task.Run(() => | |
| { |
This file contains hidden or 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 Program | |
| { | |
| // connection pool "overflow" demo | |
| private const int ConnSize = 150; | |
| static void Main(string[] args) | |
| { | |
| var connections = new SqlConnection[ConnSize]; | |
| for (int i = 0; i < ConnSize; i++) | |
| { |
This file contains hidden or 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 Program | |
| { | |
| // connection pool "overflow" demo | |
| private const int ConnSize = 150; | |
| static void Main(string[] args) | |
| { | |
| var connections = new SqlConnection[ConnSize]; | |
| for (int i = 0; i < ConnSize; i++) | |
| { |
This file contains hidden or 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 Program | |
| { | |
| private const int RecordsCount = 3000; | |
| private static readonly Stopwatch Stopwatch = new Stopwatch(); | |
| private const string InputDataFile = | |
| "C:\\Users\\Boris\\Documents\\Visual Studio 2012\\Projects\\LinearStreamProccessingWithPlinq\\PlinqTests\\DataFile1.txt"; | |
| static void Main(string[] args) | |
| { |
OlderNewer