Skip to content

Instantly share code, notes, and snippets.

Installing cl.exe with the Minimum Required Components

This article explains how to install the Microsoft C/C++ compiler (cl.exe) with a minimal setup, without installing the full Visual Studio IDE. This is useful when you only need the build tools, for example on a CI server or in a lightweight development environment.


1. Download Visual Studio Build Tools

First, download the Visual Studio Build Tools installer from the following link:

Reading Windows Environment Variables in Python Without Uppercasing

On Windows, os.environ in Python converts all environment variable names to uppercase. This is normally fine because Windows treats environment variable names as case-insensitive, but it is a problem if you want to see the original casing.

To keep the original case, you can read the environment variables directly from the Windows API using ctypes and GetEnvironmentStringsW.

With this function, the keys in env use the same casing as in the Windows environment block, instead of being forced to uppercase like os.environ on Windows.

Async Plugin Runner

1. Start the server

python server.py

Server listens on 127.0.0.1:9000 and accepts line-delimited JSON.

A Tool to Convert MSVC Environment Settings for MSYS2 Bash

When you use Microsoft Visual C++ (MSVC) from the command line, Visual Studio’s DevShell sets many environment variables (such as INCLUDE, LIB, and Path). These settings are made for Windows shells like cmd.exe or PowerShell, not for MSYS2 bash. As a result, paths and environment formats do not work directly in MSYS2.

The Python tool above automates the conversion:

  1. It runs Visual Studio Build Tools DevShell via PowerShell.
  2. It captures the environment before and after DevShell runs and outputs both as JSON.
  3. It compares these snapshots to find:

Getting the Current Wallpaper Path on Windows

If you’ve ever wanted to know exactly which image file is being used as your Windows desktop wallpaper, you might have noticed there’s no obvious option in the normal settings. However, with a bit of Python and the Windows Desktop Wallpaper API, you can get the full path to the current wallpaper image.

The script above does exactly that.


What This Script Does

A Simple Wallpaper Slideshow Tool for Windows

This article introduces a small command-line tool that sets a wallpaper slideshow on Windows. It is written in C++ and uses the Windows Desktop Wallpaper API. The tool allows you to choose multiple image files and apply them as a slideshow on your desktop.


What This Tool Does

The tool changes your desktop background to a slideshow of images.

ffmpeg options for mirabox input

This allows ffmpeg to capture without any audio or video desynchronization, but it seems that OBS has even less latency and no desync, so it might be a better option.

ffplay \
  -rtbufsize 256M \
  -use_video_device_timestamps 1 \
  -f dshow  \
 -pixel_format yuyv422 \

A Simple Tool to Search and Download Photos from Unsplash

This Python script is a handy command-line tool that searches Unsplash for photos and downloads a specified number of images to a local folder. It focuses on reliability (skipping files you already have, retrying failed downloads) and speed (using asynchronous, concurrent requests).

What the Script Does

  1. Searches Unsplash It calls Unsplash’s public search endpoint (the same one the website uses) with your query, page number, and page size.

  2. Collects Photo Items

Asynchronous Bulk Image Downloader for Pexels API (aiohttp + asyncio)

  1. Configurable Pexels search and download control Uses environment-based API key and settings (query, orientation, per-page limit, max pages, max downloads, concurrency, timeout, save directory) to control how many and what kind of images are downloaded.

  2. Asynchronous HTTP requests and file I/O Leverages aiohttp for non-blocking API calls and image downloads, and aiofiles for async file writes, with a semaphore to cap concurrent downloads.

  3. Robust file handling and deduplication Automatically infers file extensions from URLs, skips already-downloaded or duplicate photos by ID, and cleans up zero-byte partial files on errors, reporting progress and final saved count.

A Simple Tool to Tidy Up Your VS Code Windows on Windows

This Python script is a small utility that keeps your Visual Studio Code (VS Code) windows tidy on Windows. Its goal is simple: keep one “default” VS Code window open and close the rest. If there isn’t a good candidate to keep, it opens a fresh, empty VS Code window for you.

What the Tool Does

  1. Reads VS Code status: It calls code --status (via Code.exe + cli.js) to get a snapshot of your current VS Code environment—version, processes, and a section called Workspace Stats listing windows and folders.

  2. Finds VS Code windows on your desktop: