Skip to content

Instantly share code, notes, and snippets.

@nohwnd
nohwnd / Uninstall-Pester.ps1
Last active March 14, 2024 13:57
Remove built-in version of Pester 3 (or -All) from Windows 10 Program Files and Program Files (x86).
#Requires -RunAsAdministrator
function Uninstall-Pester ([switch]$All) {
if ([IntPtr]::Size * 8 -ne 64) { throw "Run this script from 64bit PowerShell." }
#Requires -RunAsAdministrator
$pesterPaths = foreach ($programFiles in ($env:ProgramFiles, ${env:ProgramFiles(x86)})) {
$path = "$programFiles\WindowsPowerShell\Modules\Pester"
if ($null -ne $programFiles -and (Test-Path $path)) {
if ($All) {

Getting to the conference

Prague has amazing public transport system, it is clean, convenient, and cheap way to get from point A to B, including from airport to city center. Prague public transport includes buses, trams, subway (metro), and some trains, boats, and also a funicular.

Tickets for Prague public transport can be bought in yellow machines, directly in trams and some busses, and more conveniently via PID Litacka app available for both iPhone and Android: https://app.pidlitacka.cz/

In the application you want to select Tickets > Buy a ticket > Prague

Tickets start at 30 CZK per single 30 minute ride for adult, but we recommend 330 CZK (14 EUR) 72 hour ticket, or 120 CZK (5 EUR) 24 hour ticket, if you plan to explore Prague a little bit.

@nohwnd
nohwnd / browser.ps1
Created January 16, 2019 09:53
Refreshing browser from other runspace
$syncHash = [hashtable]::Synchronized(@{
Browser = $null
Window = $null
})
$psCmd = [powershell]::Create()
$newRunspace = [RunspaceFactory]::CreateRunspace()
$newRunspace.Open()
$newRunspace.SessionStateProxy.SetVariable('syncHash', $syncHash)
@nohwnd
nohwnd / asciiart.ps1
Created February 13, 2019 18:52
Ascii art from api
function Get-Banner {
param (
[Parameter(Mandatory)]
[String] $Text
)
if (-not $fonts) {
$fonts = (Invoke-RestMethod -Method GET -Uri 'http://artii.herokuapp.com/fonts_list') -split "`n"
}
@nohwnd
nohwnd / UnitTest1.cs
Last active April 8, 2022 05:57
MSTest parallel output demo
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.MethodLevel)]
namespace mstest;
[TestClass]
public class UnitTest1
{
@nohwnd
nohwnd / ModuleName.Tests.ps1
Created September 8, 2019 08:11
Using ModuleName to test public surface of a module
Get-Module Pester, m | Remove-Module
Import-Module Pester -MaximumVersion 4.9.9
New-Module -Name m -ScriptBlock {
function a { "hello" }
function b { a }
Export-ModuleMember -Function b
} | Import-Module
@nohwnd
nohwnd / .gitignore
Last active October 29, 2021 12:39
Use Pester code coverage with CoverageGutters in VSCode
coverage.xml
@nohwnd
nohwnd / Import-Script.psm1
Created February 17, 2019 19:04
Importing self-contained scripts. Demo for PSPowerHour.
function Import-Script {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[String] $Path,
[Hashtable] $Parameters = @{},
[Object[]] $Arguments = @(),
[String] $EntryPoint = 'Main'
)
@nohwnd
nohwnd / wpf.ps1
Last active October 9, 2021 20:01
Weird WPF binding in PowerShell
# This example shows three versions of behavior, in the first the data binding only
# picks up the property that is defined on the type, in the second it picks up ever
# powershell adapted property Name (alias property), and in the third it picks up
# all properties even though they are all powershell properties and not on the PSObjectType
# is there some special handling for PSObject regarding WPF in Windows PowerShell?
Add-Type -AssemblyName PresentationFramework
[string]$xaml = @"
@nohwnd
nohwnd / Internal.cs
Created August 6, 2021 10:09
Find internal classes
using System;
using System.Linq;
using System.Reflection;
namespace ConsoleApp28
{
class Program
{
static void Main(string[] args)
{