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
<# | |
.SYNOPSIS | |
Pester'ng the AESThenHMAC class library | |
.EXAMPLE | |
Invoke-Pester .\AESThenHMAC.Tests.ps1 | |
#>param() | |
. (join-path $PSScriptRoot 'AESThenHMAC.ps1') | |
$ProjectName = 'AESThenHMAC' |
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
import com.opencsv.*; | |
import java.io.*; | |
class Example1{ | |
public static void main(String[] args)throws Exception{ | |
String DATA_FILE = "TestCSVparse.win.csv"; | |
char DELIMITER = ','; | |
char QUOTE = '\"'; | |
int SKIP_LINES = 0; |
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
<!DOCTYPE html> | |
<html><head> <!------------------------------------------------------------------------------------------------------------------------> | |
<title>A quick and dirty unit testing framework for JavaScript</title> | |
<!-- | |
This is free and unencumbered software released into the public domain. | |
Anyone is free to copy, modify, publish, use, compile, sell, or | |
distribute this software, either in source code form or as a compiled | |
binary, for any purpose, commercial or non-commercial, and by any | |
means. | |
In jurisdictions that recognize copyright laws, the author or authors |
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
#[switch]$AutoRun is a parameter in the host script that is used when the host-script is called by an automation context | |
#typical usage: if(!$?){throw-automated 'prevoius line is broken'} | |
funciton throw-automated([string]$Message,[int]$Offset=1){ | |
try{throw $Message} | |
catch{ | |
if(!$AutoRun){ | |
$Here = $MyInvocation | |
$LineNo = $Here.ScriptLineNumber - $Offset | |
$Line = (gc $Here.ScriptName -TotalCount $LineNo)[-1] | |
write-host "`n$_`nAt $($Here.ScriptName):$LineNo char:1`n+$Line`n" -BackgroundColor Black -ForegroundColor Red |
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
$FolderProfile = ([io.directoryinfo]((resolve-path '.').ProviderPath)).GetFileSystemInfos('*',[IO.SearchOption]::AllDirectories) | &{ | |
begin{$r=@{}} | |
process{ | |
$n = resolve-path (split-path $_.FullName) -Relative; | |
$r.$n+=$_.Length | |
} | |
end{$r} | |
}; | |
$Data = $FolderProfile.Keys | sort | &{ |
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
////////////////////////////////////////////////////////////////////////////////////// | |
// https://bytelanguage.net/2020/05/31/tpl-and-asynchronous-programming/ | |
// https://www.markopapic.com/csharp-under-the-hood-async-await/ | |
using System; | |
using System.Threading.Tasks; | |
namespace MyApplication{public class Program{ | |
public static void Main(string[] args){ | |
Foo(10).Wait(); | |
} |
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 FooBarPipe{ | |
param([parameter(ValueFromPipeline=$true)][int]$val) | |
begin{ | |
$reset = (get-item Function:\FooBarPipe).ScriptBlock | |
$Foo = { | |
param([parameter(ValueFromPipeline=$true)][int]$val) | |
begin{set-item Function:\FooBarPipe -Value $bar -Force}process{write-output ('foo {0}' -f $val)} | |
} | |
$Bar = { | |
param([parameter(ValueFromPipeline=$true)][int]$val) |
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 Download-SQLiteDLL{ | |
[Net.ServicePointManager]::SecurityProtocol = 'Tls11,Tls12' | |
$BaseURI = 'https://system.data.sqlite.org' | |
$DownloadsURI = $BaseURI + '/index.html/doc/trunk/www/downloads.wiki' | |
$r = Invoke-WebRequest -URI $DownloadsURI | |
$Entry = ([regex]'(?s)(?<=<tr>).*?(?=</tr>)').Matches($r.Content).where{$_.value -match 'sqlite-netFx46-binary-bundle-x64'}.value | |
$HashType = $Entry -replace '(?s).*\(\s*(.*?):?\s*[0-9a-fA-F]{40,}\s*\).*','$1' | |
$Hash = $Entry -replace "(?s).*\(\s*${HashType}:?\s*(.*)\).*",'$1' |
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
declare @Items as table( | |
item varchar(35) primary key | |
,MedianPrice decimal(20,6) | |
,MADprice decimal(20,6) | |
,AvgPrice decimal(20,6) | |
,MedianQty decimal(20,6) | |
,MADqty decimal(20,6) | |
-- ,QtySum decimal(20,6) | |
-- ,QtyCount decimal(20,6) | |
,AvgQty decimal(20,6) |