The aim of this page📝is to present the type command in bash, noting there is no object model in bash that one may take for granted coming from Python & Powershell.

  • note that type in bash does not tell you the type of variable you have - like type(<name>) in…

The aim of this page📝 is to give code for getting the count of files in subfolders — note that this works only in direct subfolders right, it is not recursive. …


The aim of this page📝 is to compare positional args handling in bash VS posh (PowerShell) — as part of learning bash. Always good to get a feel of the differences between languages.

  • $* is a special variable holding all of the passed arguments to the script via CLI
prnt(){…

The concern is documenting reading through the history of changes of a file using git. As I deal with both clients and colleagues who make frequent changes to config files, I quickly need to see the timeline of changes per file.

  • In VS Code, run the command
Explorer: Focus on…


The aim of this page📝 is to note how to silent git in PowerShell.

Context: I am moving my markdown files with a script to and from a backlog subfolder within a so-called slog folder — this is where I keep my work notes/to-do list. I do this quite often…


The aim of this page📝is to learn about file-like objects in python. This is a convenient and fairly informal description of a set of expectations we can place on an object. These expectations are enabled by duck typing. …


The aim of this page📝 is to describe hoisting as a mechanism in 3 interpreted, dynamically typed languages: JS, PowerShell, and Python.

  • Tried to put a helper _function to the bottom of the PowerShell functionso that it gets out of the way for readability purposes and this is not working…


The aim of this page📝 is to demonstrate the syntax for python unit tests (pytest) that pass if an exception is thrown as expected. I have a function validate_and_capitalize where I pass a section_name and section_folders and I need to test if when an improper value is passed, the ValueError with the given message is raised.

Rubberduck of the 👆 function:

  1. import pytest
  2. pass pytest.raises(Exception) into with statement
  3. in the block, call the function that is expected to fail
  4. assert exception type with e.type == <exception_type>, e.g. assert e.type == ValueError
  5. if needed, assert an error message assert "<error_msg>" in str(e.value), e.g.

The aim of this page📝 is to show a small function that accepts a list and an integer and returns the closest number from the list to the given value.

“Features” of the 👆 function:


The aim of this page📝 is to write a short PowerShell snippet finding and replacing values in all markdown files within a folder/subfolders.

  • this is for all markdown files (*.md)
  • get a .FullName property after a folder is filtered with dir command
  • iterate over the collection with ForEach-Object loop structure
  • use -Raw for Get-Content ~> Get-Content without the parameter -Raw produces an array of strings (one string per line), this would be messy with Set-Content without newlines param (see below)
  • use -NoNewLine for Set-Content ~> version control will not be finding newlines at the end
function find_and_replace($find, $replace) {
(dir *.md -Recurse).FullName | ForEach-Object {
(Get-Content -Path $_ -Raw) -replace "$find", "$replace" |
Set-Content -Path $_ -NoNewline }
}

Pavol Kutaj

Technical Support Engineer of a Data Collection Platform (Snowplow Analytics)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store