Skip to content

Instantly share code, notes, and snippets.

View nikneem's full-sized avatar
🏠
Working from home

nikneem nikneem

🏠
Working from home
View GitHub Profile
using Aspire.Hosting.Dapr;
using System.Collections.Immutable;
var builder = DistributedApplication.CreateBuilder(args);
var daprComponentsFolder = new DirectoryInfo(Path.Combine( Directory.GetCurrentDirectory(), "..\\..\\dapr\\components"));
if (!daprComponentsFolder.Exists)
{
throw new DirectoryNotFoundException($"Dapr components folder not found at {daprComponentsFolder.FullName}");
}
winget source reset --force
winget source update
winget install Microsoft.VisualStudioCode --silent --accept-package-agreements --accept-source-agreements
winget install Docker.DockerDesktop --silent --accept-package-agreements --accept-source-agreements
winget install Microsoft.VisualStudio.2022.Enterprise --silent --accept-package-agreements --accept-source-agreements
winget install GitExtensionsTeam.GitExtensions --silent --accept-package-agreements --accept-source-agreements
winget install Microsoft.PowerShell --silent --accept-package-agreements --accept-source-agreements
winget install Microsoft.AzureCLI --silent --accept-package-agreements --accept-source-agreements
winget install JanDeDobbeleer.OhMyPosh --silent --accept-package-agreements --accept-source-agreements

Azure commands

This gist contains commands or actions that make some operations extremely handy in Azure.

Batch delete resource groups

Go to the Resource Groups view and check all resource groups you want to delete. Click on the Assign Tags button and assign a tag called 'delete' without any value. Now go to the cloud shell withing the azure portal and execute the following command to delete all tagged resource groups:

az group list --tag delete --query [].name -o tsv | xargs -otl az group delete --no-wait -y -n

{
"Title": "This is a JSON file GIST",
"Description": "It can be downloaded and stored in cache",
"Addition": "This way, a second request doesn't have to download the file content again",
"Final": "But present the data immidiately from cache"
}
variables:
NUGET_XMLDOC_MODE: skip
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
trigger:
- master
stages:
- stage: build
displayName: Build
trigger:
- master
variables:
- group: prod-variables
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
stages:
- stage: Build
"parameters": {
"product_prefix": {
"defaultValue": "hellowrld",
"type": "String"
},
"storage_account_name": {
"defaultValue": "storage",
"type": "String"
},
"functions_app_name": {
public static class CognitiveServicesFunction
{
private static string subscriptionKey = Environment.GetEnvironmentVariable("COMPUTER_VISION_SUBSCRIPTION_KEY");
private static string endpoint = Environment.GetEnvironmentVariable("COMPUTER_VISION_ENDPOINT");
private static string uriBase = endpoint + "vision/v2.1/analyze";
[FunctionName("CognitiveServicesFunction")]
public static async Task Run(
[BlobTrigger("scaled-images/{name}", Connection = "")] CloudBlockBlob blob,
import { Injectable } from '@angular/core';
import * as signalR from '@aspnet/signalr';
import { PictureDto } from '@store/pictures/pictures.models';
@Injectable({
providedIn: 'root',
})
export class RealtimeService {
private connection: signalR.HubConnection;
constructor() {}
@nikneem
nikneem / config.cs
Created August 29, 2019 10:12
Add Azure Key Vault to ASP.NET
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var keyVaultClient = new KeyVaultClient(
new KeyVaultClient.AuthenticationCallback(
azureServiceTokenProvider.KeyVaultTokenCallback));
config.AddAzureKeyVault(
$"https://{yourvaultname}.vault.azure.net/",
keyVaultClient,
new DefaultKeyVaultSecretManager());