Skip to content

Instantly share code, notes, and snippets.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<None Remove="*.py" />
</ItemGroup>
<Query Kind="Statements">
<NuGetReference Version="0.8.1">docopt.net</NuGetReference>
<Namespace>DocoptNet</Namespace>
</Query>
const string docopt = """
Usage:
test.exe (-h | --help)
test.exe cmd [-abc] INPUT
@atifaziz
atifaziz / main.py
Last active April 10, 2025 10:10
Demonstration of controlled & concurrent processing of JSON messages while reading synchronously from a file queue
# /// script
# requires-python = ">=3.12"
# dependencies = []
# ///
import asyncio
from functools import partial
import json
import os
import sys
@atifaziz
atifaziz / globlin.py
Created July 4, 2024 12:55
Python script to filters paths on standard input by pattern
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) Microsoft Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@atifaziz
atifaziz / InteractiveT.cs
Last active June 13, 2024 12:23
Interact Monad, derived from https://fssnip.net/8ay (Interactive computation that asks the user questions)
// Interact Monad, derived from https://fssnip.net/8ay (by Tomas Petricek)
// Interactive computation that asks the user questions
using System;
using System.Diagnostics;
using System.Linq;
static Interactive<Color> GetColor() => new WhatColor<Color>(Interactive.Return);
static Interactive<int> GetNumber() => new WhatNumber<int>(Interactive.Return);
@atifaziz
atifaziz / StaTask.cs
Created March 24, 2024 09:51
STA thread as an awaitable task
// Author: Atif Aziz
// License: This code is released by "Author" into the public domain.
using System;
using System.Threading;
using System.Threading.Tasks;
static partial class StaTask
{
public static Task RunAsync(Action action) =>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>

MoreLINQ Signatures

Legend:

x y
type Type
() void
obj object
bool bool
@atifaziz
atifaziz / ZebraPuzzleLinq.cs
Created April 16, 2023 15:42
Zebra Puzzle solution using LINQ
#nullable enable
/* Zebra Puzzle: https://en.wikipedia.org/wiki/Zebra_Puzzle
*
> The following version of the puzzle appeared in Life International in 1962:
>
> 1. There are five houses.
> 2. The Englishman lives in the red house.
> 3. The Spaniard owns the dog.
> 4. Coffee is drunk in the green house.