Python venv cover

Getting Started with Python Virtual Environments (venv)

Getting Started with venv # 1. Create a venv (usually named .venv by convention) python3 -m venv myenv # 2. Activate - Windows (PowerShell) myenv\Scripts\Activate.ps1 # 3. Install packages - installs only into this venv pip install requests numpy # 4. Use python as typical # 5. Deactivate when done deactivate What if you close without deactivate If you close the Windows Terminal without deactivating, it’s ok. Nothing bad happens. The venv is just a folder on disk. Deactivating only removes some of the temp environment variables from your current shell session. A new console those variables are gone, effectively the same as deactivating. ...

May 9, 2026
Tools cover

Open Any File with fzf

fzf is a fuzzy finder for the terminal. Run it and you get an interactive list you can filter by typing. Select an entry and it prints the result to stdout. That makes it a composable building block. Pipe anything into it, use the output in any command. The simplest use case: open a file. Install fzf winget install junegunn.fzf Open a file with its default app & $(fzf) fzf walks the current directory recursively, shows you the files, and you pick one. The & call operator invokes whatever path comes back. On Windows this triggers the default file association, so .py opens in your IDE, .docx opens in Word, and so on. ...

May 9, 2026
Tools cover

ripgrep: Search by Filename Only

ripgrep (rg) is built to search inside files, but sometimes you just want to find files by name. The same job as find or Get-ChildItem -Filter. There are two clean ways to do it. Method 1: --files with -g (glob) rg --files -g 'Launch-VsDevShell.ps1' --files tells ripgrep to list every file it would search — no content search happens at all -g (or --glob) filters that list to filenames matching the pattern This is the clearest way to express “find files named X”. The glob supports wildcards: ...

May 9, 2026
Tools cover

How to Get Text from a Wikipedia Page

Wikipedia makes it easy to extract page content without scraping HTML. Wikipedia exposes two APIs for this. The MediaWiki Action API (/w/api.php) handles raw wikitext and plain text; and the REST API (/api/rest_v1/) returns full HTML. Between them they offer three useful methods: raw wikitext via action=raw, full HTML via the REST API, and plain text via the TextExtracts endpoint. Method 1: Raw wikitext via URL Append ?action=raw to any Wikipedia article URL and you get the raw wikitext — the markup source Wikipedia stores internally: ...

May 3, 2026
Tools cover

Search Inside DOCX Files with ripgrep and pandoc

DOCX files are binary ZIP archives and rg can’t search them directly. The fix is to pipe each file through pandoc, which converts DOCX to plain text (or Markdown) on the fly before rg searches it. Prerequisites Install both tools if you don’t have them: winget install BurntSushi.ripgrep.MSVC winget install JohnMacFarlane.Pandoc Search all DOCX files recursively Get-ChildItem *.docx -Recurse | % { echo "---" echo $_.Name pandoc $_.FullName -t markdown | rg -i 'my search string' } Argument Meaning *.docx Glob pattern, match only .docx files -Recurse Walk subdirectories recursively % Alias for ForEach-Object, runs the block for each file $_.FullName Full absolute path of the current file (required by pandoc) -t markdown Tell pandoc to output Markdown; preserves heading structure so you can see where in the document a match falls -i Case-insensitive search in ripgrep 'my search string' The search query (use single quotes in PowerShell to prevent string interpolation) Show context around matches Use -C to print lines before and after each match: ...

May 3, 2026
Windows cover

Windows: Convert PDF to Images

Extract Images from PDF pdftopng converts PDF pages directly to PNG in a single step. Alternatively, pdftoppm (also xpdf-tools) converts to PPM image first, then ImageMagick magick mogrify can batch convert to PNG. ImageMagick can read PDFs directly but requires a Ghostscript dependency. Skip the extra dependency and use xpdf-tools instead. convert is a built-in Windows command (disk conversion tool), so always prefix with magick when using ImageMagick convert command. ...

April 21, 2026
Windows cover

Windows: SSH Setup

1. Installing OpenSSH Server Download the OpenSSH server package from the PowerShell/Win32-OpenSSH releases page (the official Microsoft port maintained by the PowerShell team). Run the following in an admin PowerShell session on the server to allow incoming SSH connections: New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 Argument Description -Name sshd A short internal name for the firewall rule used to identify it programmatically -DisplayName 'OpenSSH Server' A human-readable label shown in the Windows Firewall UI -Enabled True Activates the rule immediately upon creation -Direction Inbound Applies the rule to incoming traffic -Protocol TCP Restricts the rule to TCP traffic (SSH runs over TCP) -Action Allow Permits matching traffic through the firewall -LocalPort 22 Targets port 22, the standard SSH port 2. Configuring the Default Shell for OpenSSH By default, OpenSSH on Windows will use cmd.exe. To change this to PowerShell, set the DefaultShell registry key. ...

April 19, 2026
Tools cover

ripgrep: Search for a String Literal

Doing a literal search with ripgrep is easy and can be done with the -F parameter. To search for a string literal and not a regex, use: rg -F 'my string literal' Searching for a string literal is useful when you have to look for a string that ripgrep would interpret as regex (this behavior is by default). This is often the case when searching for snippets of code. For example, ...

October 29, 2024
Tools cover

jq: Validate JSON

Quick tip today. I wanted to validate my JSON file with jq. jq can read files directly rather than requiring piped input, which is useful for large files. jq has the ability to read the file directly, which is great if your json file is large. By default jq prints out the loaded file. However, we use empty to not display any output. By default if there are any errors in the json file jq will output where the error is. ...

October 28, 2024
Windows cover

Windows: ImageMagick Install Guide

Why ImageMagick is Recommended Why should you use ImageMagick? Free - no subscriptions, nothing to required to buy sponsorship is most welcomed though! 1 Offline - no having to upload your personal files online Format support: JPEG, PNG, GIF, TIFF, and PDF Open source2 Been around since forever (2009😜) 3 Why Use ImageMagick as a Software Developer? it uses the command line - impress your friends lots of utilities and arguments for editing and manipulating images - impress yourself Where to Get ImageMagick For Windows ImageMagick can be downloaded at ImageMagick - Download. The ImageMagick team recommends a version at the top of the table ending in Q16-HDRI-x64-dll.exe. ...

September 17, 2024
PowerShell cover

Find the Visual Studio Developer PowerShell script

Finding the Developer PowerShell launch script can be difficult as the location for it has change across the different Visual Studio versions (e.g., 2019, 2022), editions (e.g., Community, Professional, Enterprise), and installation location. Visual Studio 2022 and newer install the ‘Developer PowerShell for VS 2022’ as a Windows Terminal profile. This is the easiest way to access it. However, if you want to access it from a PowerShell ps1 script it is more complicated. Accessing via script is done typically if you have to run the script on another system where you don’t know which Visual Studio version/edition/location installed. ...

September 12, 2024
Tools cover

ripgrep: Suppress 'Access is Denied' error message

Ripgrep (rg) is a popular command-line search tool inspired by the popular GNU grep tool. The Access is denied. (os error 5) is a common error message that appears when trying to read a file or directory that ripgrep does not have permission to access. This can be annoying when doing a system wide search when many system directories or other protected directories may be searched, littering the results with many “access is denied” error messages. Luckily the messages can be suppressed. ...

September 10, 2024
Tools cover

ripgrep: Search Stats and Match Count

When searching through large code bases or directories, it’s helpful to get a sense of how many matches were found by your search query. While tools like ripgrep can give you the exact lines where a match was found, they don’t always provide an easy way to see the total number of hits. This is where ripgrep --stats and --count comes in. With these arguments we can get stats about what was found and results per file. ...

September 9, 2024
Windows cover

Windows Terminal: Quake Mode

Cool trick with the Windows Terminal is Quake mode. The name comes from the Quake games’ console. The Quake console was used to send commands to the game such as /god for God mode or /give all to get all game items. The Quake in-game console was shown by pressing tilde ~ key. A similar behavior can be accomplished with Windows Terminal called Quake mode. In Windows Terminal quake mode the terminal is snapped to the top of the screen. The bottom of the window can be sized but the window is docked to the top. ...

July 27, 2023
Windows cover

Windows Terminal Starting Directory

I often need to jump into a command-line interface (CLI) in Windows from an Explorer window. Previous, I used to type cmd . into Explorer’s current directory (press F4 to hightlight) to open the current directory. However, I have been using Windows Terminal (wt) more than the classic Command Prompt (cmd) for some of the quality of life features (e.g., tabs). To call Windows Terminal from Explorer type wt into the current directory – but this does not open the current directory. Neither does wt ., you’ll get an obscure error: [error 2147942405 (0x80070005) when launching .]. If you look at the help (wt --help), it is burried in the help. If you do wt new-tab --help will have the starting directory command. ...

July 20, 2023
Tools cover

Cleaning Up Your Visual Studio 2019 Build with a Script

Clean the Visual Studio 2019 x64 Release or Debug build directory using Clean-Build.bat batch script. Place in the x64 directory and run the bat. Great if you need to archive your project before sending and don’t want to send a bunch of extra files. Tested with Visual Studio 2019 and 2022. The script can be expanded to remove other kinds of files. Files Removed File type Usage *.ipdb Incremental Link-Time Code Generation - Program database (PDB) file *.iobj Incremental Link-Time Code Generation - Object file *.pdb Program database (PDB) *.idb Intermediate debug file / state file used for minimal rebuild and incremental compilation *.ilk Intermediary linker files *.exp DLL exports *.obj Object file - compiled code that the linker uses *.tlog Used for incremental builds - information about all inputs / outputs *.FileListAbsolute.txt List of files built in current build *.recipe Used in Guidance Automation Toolkit Notes Important to use .\ before paths, otherwise it will execute from the drive’s root directory If there is more than one condition that needs to be used an if statement then must use nested if statements can use defined to check if a variable is defined or not defined if not defined. Clean-Build.bat @echo off setlocal enableextensions setlocal EnableDelayedExpansion set ExecutableName=%1% set BuildType=%2% if not defined BuildType ( echo Usage: Clean-Build.bat ExecutableName BuildType exit /b 1 ) if not "%BuildType%" == "Debug" ( if not "%BuildType%" == "Release" ( echo Usage: Clean-Build.bat ExecutableName BuildType echo Build must be Release or Debug exit /b 1 ) ) if not defined ExecutableName ( echo Usage: Clean-Build.bat ExecutableName BuildType exit /b 1 ) echo Cleaning: %ExecutableName% echo Build type: %BuildType% :: Release builds if "%BuildType%" == "Release" ( del .\%BuildType%\*.iobj del .\%BuildType%\*.ipdb ) :: Debug builds if "%BuildType%" == "Debug" ( del .\%BuildType%\*.ilk del .\%BuildType%\*.idb ) :: Both builds del .\%BuildType%\*.tlog del .\%BuildType%\*.obj del .\%BuildType%\*.recipe del .\%BuildType%\*.pdb del .\%BuildType%\*.log del .\%BuildType%\*.FileListAbsolute.txt rmdir /S /Q .\%BuildType%\%ExecutableName%.tlog echo Done

May 29, 2023
Windows cover

How to Convert an Image to PDF on Windows

Adobe Acrobat is probably the most professional way to convert an image to a PDF but it requires creating/signing into an account and paying a monthly fee – no thanks! I propose alternative ways to convert an image to a PDF depending what is available on your computer. Method 1: Convert Image to PDF using MS Word If Microsoft Word is available then the easiest method is to use Word and Export to a PDF. The easiest and highest quality method to convert an image (e.g., jpg, png, bmp, etc) to pdf is to use Microsoft Word. No need for external apps or websites. ...

September 6, 2021