Skip to content

Instantly share code, notes, and snippets.

Aspire Pre-provisioned Resource Support

var builder = DistributedApplication.CreateBuilder(args);

var storage = builder.AddAzureStorage("storage").RunAsEmulator();
var queue = storage.AddQueues("queue");
var blob = storage.AddBlobs("blob");
var eventHubs = builder.AddAzureEventHubs("eventhubs").UseExisting().AddEventHub("myhub");
var serviceBus = builder.AddAzureServiceBus("messaging").UseExisting().WithQueue("myqueue");
@captainsafia
captainsafia / aspire-azure-functions-resources.md
Created November 13, 2024 00:36
Resources on the Aspire + Azure Functions integration for .NET Conf 2024
@captainsafia
captainsafia / pe_018.py
Created August 17, 2012 21:31
Solution to Project Euler Problem 18 in Python
tri_num=[
[75],
[95, 64],
[17, 47, 82],
[18, 35, 87, 10],
[20, 04, 82, 47, 65],
[19, 01, 23, 75, 03, 34],
[88, 02, 77, 73, 07, 63, 67],
[99, 65, 04, 28, 06, 16, 70, 92],
[41, 41, 26, 56, 83, 40, 80, 70, 33],

Note

The details shared here are based on the prototyping done as of 2/3/2024. If you're reading this gist at a later time, the details might have changed. In any case, it's here for archival reasons.

This gist is written in response to a tweet by Adam Storr (@WestDiscGolf) in response to a code sample that was shared of the current prototype of our workstream to sharpen up event-based apps.

Sure. The "with provider" and "map events" methods, how they work together and are processed under the hood. For example when/how a message arrives and triggers the binding/handler. Thanks for your reply :-)

The prototype code looks like this:

@captainsafia
captainsafia / Program.cs
Last active December 11, 2023 06:57
Titan: the small but mighty API framework (requires .NET 7)
using System.Net;
using System.Text;
var port = 8080;
var server = new Server(port);
server.UseAuthentication();
server.UseRouting();
server.UseNotFoundPage();
@captainsafia
captainsafia / pe_019.py
Created August 18, 2012 21:56
Solution to Project Euler Problem 19 in Python
from datetime import date
sundays=0
for year in range(1901,2001):
for month in range(1,13):
if date(year,month,1).weekday()==6:
sundays+=1
print sundays
make: Entering directory '/home/captainsafia/github.com/dotnet/runtime/src/mono/wasm'
/home/captainsafia/github.com/dotnet/runtime/dotnet.sh build --configuration debug --nologo /p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=Debug /p:RuntimeConfiguration=Release /home/captainsafia/github.com/dotnet/runtime/src/mono/wasm/debugger/tests/debugger-test
Determining projects to restore...
All projects are up-to-date for restore.
Determining projects to restore...
All projects are up-to-date for restore.
WasmAppBuilder -> /home/captainsafia/github.com/dotnet/runtime/artifacts/bin/WasmAppBuilder/Debug/net5.0/WasmAppBuilder.dll
WasmAppBuilder -> /home/captainsafia/github.com/dotnet/runtime/artifacts/bin/WasmAppBuilder/Debug/net5.0/publish/
debugger-test -> /home/captainsafia/github.com/dotnet/runtime/artifacts/bin/debugger-test/wasm/Debug/debugger-test.dll
@captainsafia
captainsafia / prompt_party
Created May 26, 2017 13:58
Set different parts of your command prompt with different random colors
# Prints username@hostname working-directory>
function prompt_party {
PS1="\[\033[38;5;$(jot -r 1 1 256)m\]\u\[\033[00m\]"
PS1="$PS1\[\033[38;5;$(jot -r 1 1 256)m\]@\[\033[00m\]"
PS1="$PS1\[\033[38;5;$(jot -r 1 1 256)m\]\h\[\033[00m\] "
PS1="$PS1\[\033[38;5;$(jot -r 1 1 256)m\]\w\[\033[00m\]> "
}
PROMPT_COMMAND=prompt_party
This file has been truncated, but you can view the full file.
ãÏΩ `$YY/>=3;≥3ô˜˚π€Û⁄I≤ìÓŒ£ìÃÑ:ùN¶ôºHw2+Œ⁄V∫+IÌTW5U’yÃ≤¿" Ëe—ã¢"EPƒ'ˇ{UTƒr≈+
xˇ»S\‰≠ÇäWÓy’˚‘©Í$›]=ª∞ªIͺæsŒÔ˚ŒwæÛùÔÏ⁄≤eK€Cs√Ç4./é
"?ÕiK≈gU^Q„EÆ¢qǧr _ÊaA(rö Kj|X‰Ó»©ëë˘û‚í¨jÒØÄ Ò≤:_ƒRl^êDyÒøæ˜ΩÔÌGˇ˘û◊"{@”ú≤Z_‰ïüyÈÊî¡O‹ª5“ˆ–±tUQxIõÕ¶´¢VU¯áx©k6WsùÉ?•◊È€7 ©ã™ßh|)y Ú8≠Û¯\.=5í)åeÛÖTÓ∆t*ó+LÇkÒT•"›û‘*'FsZµ$»—¥\‚c\•OÀíHU„£
WÊWdÂ∂áâ—κX·ïh˚ /ïxÖW:ÏŸ'∏‚TŒ#ÁÖâ¢v\ÊJBQëUyAÀs "Ø©3<Wö탵ÌöRÂ#ÖÁ–ÊkQ–ñ™Û±¢\éódM‚µ8ßV¿è¢¨Ò˘ÑÏzx:]OçÂ∂%V€¶s›üå¥õπ;¢óFª¯XEëÀ≠PSQ( ¢¨®fl_`y‰Ò«/Ω¯“¬ÓKèÌΩÙ¯•ˆÓûπÃN…Ω,(=^Z~‰ÒK›=Àó¢±éK̜Ҡè?]S´≈"Ø™è<ÓìèWYy‰Ò;•`Æ5ûdÕ.D∑èß&«⁄x©0õãÕÊGª˜LŒM“#x∂vΩH>33QòûôõIMÊ23πÏ‘‰éÓXfl@¨˜¿»T~2ì/\ü Â ”©¸ı
}zj|j∂∏ Œ%Í—˛Ù‘‰H™êæÕÄ…ÿ*…˜‰Æg∆«ÔçæäflQóvéOçM¶&2{¨ÕÇ<„s„ëfi˚çÈÒl!üœLdÚ3flW»er∞Ÿëã=•~`a`æ´Øßo°´Ø/¡u]MÙp] Ω|i†o`∞ƒœóv‰'¶G≤3›ÒeNâ/»b ˆ±‘_Ë}°tµwMÍÔª3∏ÿ/ˆı]]],™} øE)ûèü®ùÕéè‰S3cô¸‘l~z6àÀNé!∞Ó'®Œç‹P°®ππÓÒSK∑„…X"÷ùHt)≈Xw¨'—óËçu_çÁJ∑’623SS˘¡ı∂±"c8;ŸC´ &-ó°PTë`ê«óª˚bÄ$8KßÊ≤3˘Ÿ‘x!39W…ÊR√„à©âȸ÷Óû6ãòyAmfÜW™"?Û´‡+¶t(^Tÿè€NUcÍ“ 2≥„˘Ïxf.3^üö∫1;IϱÇ|«≤Z