Skip to content

Instantly share code, notes, and snippets.

View syedhassaanahmed's full-sized avatar

Hassaan Ahmed syedhassaanahmed

View GitHub Profile
@stettix
stettix / things-i-believe.md
Last active March 20, 2024 17:45
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@lakeman
lakeman / AutoMigration.cs
Last active October 9, 2023 00:30
Automatic database migration with EF Core 3.0
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design.Internal;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Migrations.Design;
using Microsoft.EntityFrameworkCore.Migrations.Operations;
using Microsoft.EntityFrameworkCore.Storage;
@ChristopherHaws
ChristopherHaws / AsyncUtilities.cs
Last active August 6, 2023 15:31
EFCore Azure AccessToken
using System.Collections.Generic;
namespace System.Threading.Tasks
{
public static class AsyncUtilities
{
/// <summary>
/// Execute's an async Task{T} method which has a void return value synchronously
/// </summary>
/// <param name="task">Task{T} method to execute</param>
@krist00fer
krist00fer / Get-AzureUsageCost.ps1
Last active November 2, 2023 18:09
PowerShell Script to retrieve Azure Usage and Cost/Pricing
# Licensed under the MIT license.
# Copyright (C) 2017 Kristofer Liljeblad
# 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 copies of the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@miloszpp
miloszpp / RunOpenCover.ps1
Created October 6, 2017 13:54
PowerShell script to generate coverage reports using OpenCover
Param(
[string]$sourcesDirectory, #the root of your project
[string]$testAssembly, #the file pattern describing test assemblies to look for
[string]$testFiltercriteria="", #test filter criteria (as in Run Visual Studio Tests task)
[string]$openCoverFilters="+[*]*" #OpenCover-specific filters
)
. $PSScriptRoot\vsts-task-lib\LongPathFunctions.ps1
. $PSScriptRoot\vsts-task-lib\TraceFunctions.ps1
. $PSScriptRoot\vsts-task-lib\LegacyFindFunctions.ps1
@gregjhogan
gregjhogan / random-string-generator.ps1
Last active February 6, 2024 13:39
Generate random string in powershell
#lowercase letters/numbers only
-join ((48..57) + (97..122) | Get-Random -Count 32 | % {[char]$_})
# all characters
-join ((33..126) | Get-Random -Count 32 | % {[char]$_})
@richardkundl
richardkundl / BloomFilter.cs
Created January 7, 2014 14:29
Bloom filter implementation in c#.
namespace BloomFilter
{
using System;
using System.Collections;
/// <summary>
/// Bloom filter.
/// </summary>
/// <typeparam name="T">Item type </typeparam>
public class Filter<T>
@jongalloway
jongalloway / PcRepave.cmd
Last active February 23, 2023 18:02
Chocolatey list generated using: choco list --localonly --idonly
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco feature enable -n allowGlobalConfirmation
choco install 7zip /y
choco install 7zip.install /y
choco install ARMClient /y
choco install audacity /y
choco install audacity-lame /y
choco install autohotkey /y
choco install autohotkey.install /y
@metaskills
metaskills / gist:893599
Created March 29, 2011 23:54
A Copy Of sp_MSforeachtable Stored Procedure For Azure, Uses sp_MSforeach_worker
CREATE proc [dbo].[sp_MSforeachtable]
@command1 nvarchar(2000), @replacechar nchar(1) = N'?', @command2 nvarchar(2000) = null,
@command3 nvarchar(2000) = null, @whereand nvarchar(2000) = null,
@precommand nvarchar(2000) = null, @postcommand nvarchar(2000) = null
AS
declare @mscat nvarchar(12)
select @mscat = ltrim(str(convert(int, 0x0002)))
if (@precommand is not null)
exec(@precommand)