Skip to content

Instantly share code, notes, and snippets.

@RadAd
RadAd / PipeTest.bat
Last active June 3, 2025 06:14
Pipe text into a process
@echo off
(for %%i in (
"Mango 1"
"Orange 2"
"Cherries 3"
"Apple 4"
) do @echo %%~i) | sort
@RadAd
RadAd / #RadVSProps.md
Last active June 2, 2025 08:41
Default msbuild property files for my projects

RadVSProps

Default msbuild property files for my projects

@RadAd
RadAd / memfile.c
Created April 24, 2025 01:03
Memory based file
#include "memfile.h"
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <io.h>
#include <fcntl.h>
#include <process.h>
@RadAd
RadAd / #BatchUtils.md
Last active June 5, 2025 01:45
Collection of batch script utilities.

Batch Utils

Collection of batch script utilities.

Excutes a command for each line in the input file. Uses for but allows you to pipe in the file.

Prints the number of lines in the input file.

#include <cstdio>
#include <optional>
#include <memory>
#include <set>
std::optional<int> foo()
{
return {};
}
#include <cstdio>
#include <iterator>
template <class T>
class value_iterator : public std::iterator<std::random_access_iterator_tag, T>
{
public:
value_iterator(T v)
: m_v(std::move(v))
{
@echo off
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
prompt $G$S
set BAR_A=########################################
set BAR_B=%BAR_A:#=_%
set BAR_S=40
set C=500
echo.
for /L %%i in (0,1,%C%) do (
call :progress %%i %C%
@RadAd
RadAd / !CppExtras.md
Last active September 23, 2024 07:00
CppExtras: Cpp utilities.

Cpp utilities.

#include <charconv>
#include <type_traits>
#include <cwctype>
// -----
// Helper alias templates
template<typename T>
using EnableIfIntegral = std::enable_if_t<std::is_integral<T>::value, bool>;
#define _ATL_APARTMENT_THREADED
#include <atlbase.h>
#include <atlwin.h>
class CMainWnd :
public CWindowImpl<CMainWnd, CWindow, CFrameWinTraits>
{
public:
static LPCTSTR GetWndCaption()