Skip to content

Instantly share code, notes, and snippets.

View sayedihashimi's full-sized avatar

Sayed Ibrahim Hashimi sayedihashimi

View GitHub Profile
@sayedihashimi
sayedihashimi / 10M-01-number-details.txt
Last active April 14, 2022 19:44
Stats from roulette simulator
Number of spin: 100,000,000
Number details ---------------------------------------------
Number of black and red swaps: 47,364,836
---- 1 ----
Number of hits: 2,633,633
Max # spins since last hit: 551
Max # of consecutive hits: 5
@sayedihashimi
sayedihashimi / msbuild-error-format.md
Last active February 17, 2022 18:54
MSBuild and Visual Studio Known Error Message Formats

MSBuild and Visual Studio Known Error Message Formats

When a tool is executed that outputs some text, MSBuild will examine the text for errors and warnings. Many tools use a known format to report these messages. By default, MSBuild will examine the text and report errors and/or warnings based on the output. This behavior can be changed or disabled by using these parameters on the Exec task: IgnoreStandardErrorWarningFormat, CustomErrorRegularExpression, and CustomWarningRegularExpression.

NOTE: If you do decide to use your own regular expression to detect error and warnings, then

@sayedihashimi
sayedihashimi / allowlistforpihole.txt
Created March 26, 2021 19:00 — forked from shanselman/allowlistforpihole.txt
A gist with an ALLOW LIST for a PiHole to make sure your XBox and Windows Services keeps working and appropriate anonymized telemetry goes where it needs to go
analytics.twitter.com
api.mixpanel.com
api.segment.io
attestation.xboxlive.com
az416426.vo.msecnd.net
browser.pipe.aria.microsoft.com
c.bing.com
c.msn.com
c1.microsoft.com
cdn-gl.imrworldwide.com
@sayedihashimi
sayedihashimi / Get-CurrentBranch.ps1
Created July 16, 2020 20:05
Get-CurrentBranch powershell function
function Get-CurrentBranch{
[cmdletbinding()]
param()
process{
[string]$result = &git branch --show-current
if(-not $result){
$result = $result.trim();
}
$result
}

Add the target below to the project file for your dotnet core global tool. You can run this target to simplify reinstalling the global tool. You can execute this target with dotnet build -t:InstallTool.

When this target is executed the following will happen (in this order):

  • Project is packed into a NuGet package
  • Tool is uninstalled with dotnet tool uninstall
  • Tool is installed with dotnet tool install
  • Help is called on the tool just installed
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<!-- remove duplicate .json files from Content -->
<Content Remove="appsettings.json;appsettings.Development.json;bundleconfig.json" />
<Content Include="appsettings.json" Condition="Exists('appsettings.json')" />
<Content Include="appsettings.Development.json" Condition="Exists('appsettings.Development.json')" />
<Content Include="bundleconfig.json" Condition="Exists('bundleconfig.json')" />
<!-- remove .ts files from None, they should be in TypeScriptCompile instead -->
<None Remove="**/*.ts" />
@sayedihashimi
sayedihashimi / extract-interface.gif
Last active November 8, 2018 21:13
Some sample Quick Fix actions available in Visual Studio for Mac
extract-interface.gif
@sayedihashimi
sayedihashimi / limit-nuget.md
Last active July 6, 2018 14:34
how to limit nuget packages and versions to specific ones

Question: How can I ensure that all projects only use a specific set of nuget packages and versions? I'm using VS2017.

The way that I would handle this is to add a (directory.build.targets)[https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build#directorybuildprops-and-directorybuildtargets] to help in this scenario.

The idea is that you will add an msbuild .targets file in the source root named directory.build.targets. In that file you can inject a target to be run before the build starts. For example,

@sayedihashimi
sayedihashimi / how-to-publish-to-multiple-iis.md
Last active March 19, 2022 19:32
How to publish a web project to multiple IIS sites

Scenario:

  • I have a web project that I want to publish to multiple IIS sites
  • Publish in VS should publish to devs local IIS server (MSDeploy)
  • Publish from CI/CLI should publish to remote env (MSDeploy)
  • CI/CLI and VS publish should be the same
  • Building the solution takes ~3 min and should only be performed once
  • Config files need to be transformed based on the dest env

Question:

How can I accomplish this?

@sayedihashimi
sayedihashimi / dotnet-new-templates.txt
Last active July 24, 2017 18:54
Templates availabe on nuget.org for dotnet new
--- template report ---
Name DownloadCount Percent overall
---- ------------- ---------------
Microsoft.AspNetCore.SpaTemplates 44876 65.4 %
Microsoft.DotNet.Web.Spa.ProjectTemplates 6253 9.1 %
libyear 1860 2.7 %
Boilerplate.Templates 1600 2.3 %
IdentityServer4.Templates 1136 1.7 %
Amazon.Lambda.Templates 1122 1.6 %