Skip to content

Instantly share code, notes, and snippets.

View jzabroski's full-sized avatar
🎯
Focusing

John Zabroski jzabroski

🎯
Focusing
View GitHub Profile
@GuyHarwood
GuyHarwood / essential_libs.md
Last active May 9, 2019 19:20
just a list of libraries that are useful to automatically install into new projects

CS

  • Install-Package netfx-Guard
  • Install-Package NSubstitute (or Moq)
  • Install-Package xUnit
  • Install-Package AutoFixture
  • Install-Package AutoMapper
  • Install-Package SimpleInjector
  • Install-Package FluentMigrator
  • Install-Package GitVersion
@Jaykul
Jaykul / WhatIsIt.ps1
Created December 19, 2016 05:22
All those informative variables in PowerShell 6.0
$script:IsWindows = (-not (Get-Variable -Name IsWindows -ErrorAction Ignore)) -or $IsWindows
$script:IsLinux = (Get-Variable -Name IsLinux -ErrorAction Ignore) -and $IsLinux
$script:IsOSX = (Get-Variable -Name IsOSX -ErrorAction Ignore) -and $IsOSX
$script:IsCoreCLR = (Get-Variable -Name IsCoreCLR -ErrorAction Ignore) -and $IsCoreCLR
$script:IsNanoServer = $null -ne ('System.Runtime.Loader.AssemblyLoadContext' -as [Type])
$script:IsInbox = $PSHOME.EndsWith('\WindowsPowerShell\v1.0', [System.StringComparison]::OrdinalIgnoreCase)
@LitKnd
LitKnd / Execution-Cache-Single-Use-Plans-Explore.sql
Created January 31, 2017 17:50
TSQL to do a quick and dirty look at single-use plans in the execution plan cache of a SQL Server.
/***********************************************************
TSQL to do a quick and dirty look at single-use plans in
the execution plan cache of a SQL Server.
************************************************************/
/* Size of single use adhoc plans in execution plan cache */
SELECT
objtype,
cacheobjtype,
SUM(size_in_bytes)/1024./1024. as [MB]
@Saissaken
Saissaken / Update git fork with tags.sh
Last active May 14, 2025 10:18
Update git fork with tags
# Repo: someuser/myframework
# Fork: superteam/myframework
# Track:
git clone https://github.com/superteam/myframework.git
cd myframework
git remote add upstream https://github.com/someuser/myframework.git
# Update:
git fetch upstream
function a($f) {& $f}
function main() {
$f = {write-host 'success'}
a {& $f} # stack-overflow
a {& $f}.getnewclosure() # okay
}
[void] (main)
set-strictmode -version 'latest'
$erroractionpreference = 'stop'
function main() {
$a = 'foo'
$f = {
$g = {$a}.getnewclosure()
& $g # "variable '$a' cannot be retrieved because it has not been set."
}.getnewclosure()
& $f
@therightstuff
therightstuff / RSAKeys.cs
Last active June 30, 2025 13:51
Import and export RSA Keys between C# and PEM format using BouncyCastle
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@dasMulli
dasMulli / Directory.Build.targets
Last active February 21, 2022 23:44
CI build script for a mvc + Webpack SPA app
<Project>
<Target Name="NpmInstall" Condition="Exists('package.json')">
<Exec Command="npm install" />
</Target>
<Target Name="NpmCiTest" Condition="Exists('package.json')">
<Exec Command="npm run ci-test" />
<ItemGroup Condition="'$(TestResultsOutputPath)' != ''">
<TestResultFiles Include="obj\karma-testresults\**" />
@urasandesu
urasandesu / Program.cs
Created December 21, 2017 12:11
Using F# Data as a runtime type inferencer for a csv file
using FSharp.Data;
using FSharp.Data.Runtime;
using FSharp.Data.Runtime.StructuralTypes;
using Microsoft.FSharp.Collections;
using System;
using System.Globalization;
using System.Linq;
class Program
{
@galenguyer
galenguyer / CodeEval.cs
Last active February 27, 2020 01:44
Arbitrary Code Execution for C#
using System;
using System.CodeDom.Compiler;
using System.Reflection;
using System.Threading.Tasks;
/*
To execute, run
string code = "your code here";
if (!code.Contains("return")) code = "return " + code;
code = code.Trim().TrimEnd(';') + ";";