Skip to content

Instantly share code, notes, and snippets.

View jzabroski's full-sized avatar
🎯
Focusing

John Zabroski jzabroski

🎯
Focusing
View GitHub Profile
@jzabroski
jzabroski / Program.cs
Created December 30, 2022 15:20 — forked from AnthonyGiretti/Program.cs
Example of Polly retry policy on gRPC client
using DemoGrpc.Domain.Entities;
using DemoGrpc.Protobufs;
using Grpc.Core;
using Microsoft.Extensions.DependencyInjection;
using Polly;
using System;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using static DemoGrpc.Protobufs.CountryService;
@jzabroski
jzabroski / commit-config.sh
Created January 20, 2022 16:10 — forked from tqheel/commit-config.sh
Prevent ASP.Net Web.Config From Being Committed By Git
#Run this to reverse ignoring of changes to web.config so it gets committed.
git update-index --no-assume-unchanged path_to_file/web.config
@jzabroski
jzabroski / CodeEval.cs
Created February 27, 2020 01:44 — forked from galenguyer/CodeEval.cs
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(';') + ";";
@jzabroski
jzabroski / keybase.md
Created December 11, 2019 22:24
Keybase proof

Keybase proof

I hereby claim:

  • I am jzabroski on github.
  • I am johnzabroski (https://keybase.io/johnzabroski) on keybase.
  • I have a public key ASDMWKXdhimJDGdWnb6YFpabkXxft4PBiHEAWI1zDB-GMQo

To claim this, I am signing this object:

@jzabroski
jzabroski / Fix broken dependencies on all objects
Created March 15, 2018 14:20
Fix broken dependencies on all objects
-- Originally from: https://mssqlwiki.com/2012/05/04/copy-database-wizard-or-replication-setup-might-fail-due-to-broken-dependency/
--Below script will fix the broken dependencies on all the objects
----------------------------------------------------------------------------
--List of objects for which referenced objects are missing.
--ex: View created on table XYZ and table XYZ is dropped
----------------------------------------------------------------------------
SELECT OBJECT_NAME (referencing_id),referenced_database_name, referenced_schema_name, referenced_entity_name
FROM sys.sql_expression_dependencies
WHERE referenced_entity_name not in (select name from sysobjects)
@jzabroski
jzabroski / RestartService.ps1
Created December 4, 2017 17:58
Restart Windows Service and its currently running Dependent Services
Param (
[Parameter(Mandatory=$true)] [String]$ServiceName
)
<#
From: https://gallery.technet.microsoft.com/PowerShell-Script-for-8243e5d1
This is a PowerShell Script to restart a windows service with its dependent services. The dependent services that were not running when the restart request made, will not be started, so that the system services state will remain same after restart service script run.
#>
[System.Collections.ArrayList]$ServicesToRestart = @()
@jzabroski
jzabroski / New-RsSubscription_0.0.2.9_hotfix
Created October 20, 2017 22:08
Hotfix for ReportingServicesTools Issue #85
# Copyright (c) 2016 Microsoft Corporation. All Rights Reserved.
# Licensed under the MIT License (MIT)
function New-RsSubscription {
<#
.SYNOPSIS
This script creates a new reporting subscription.
.DESCRIPTION
This script creates a new reporting subscription based on the parameters provided. NOTE: A new subscriptionId will be generated.
-- Taken from: http://sqlblog.com/blogs/hugo_kornelis/archive/2014/07/18/database-mail-and-then-the-smtp-server-changed.aspx
DECLARE @NewServer sysname = 'NotTelling.mail', -- New SMTP server
@OldServer sysname = 'MySecret.mail', -- Old SMTP server
@account_id int;
DECLARE Cursor_MailAccounts CURSOR LOCAL FORWARD_ONLY STATIC READ_ONLY
FOR SELECT account_id
FROM msdb.dbo.sysmail_server
WHERE servername = @OldServer; -- Add extra logic here
@jzabroski
jzabroski / SSRS-ExportReports.ps1
Created July 28, 2017 21:52
Export of SSRS reports datasources and images
<# .SYNOPSIS
Export of SSRS reports datasources and images
.DESCRIPTION
This PowerShell script exports all (or filtered) reports, data sources and images directly from the ReportServer database
to a specified folder. For the file name the complete report path is used; for file name invalid characters are replaced with a -.
Reports are exported with .rdl as extension, data sources with .rds and resources without any additional extension.
Please change the "Configuration data" below to your enviroment.
Works with SQL Server 2005 and higher versions in all editions.
Requires SELECT permission on the ReportServer database.
.NOTES
@jzabroski
jzabroski / Create_SQLAgentJobSripts.ps1
Created July 26, 2017 20:09
PS script to generate all SQL Server Agent jobs on the given instance.
# Date: 16/02/14
# Author: John Sansom
# Description: PS script to generate all SQL Server Agent jobs on the given instance.
# The script accepts an input file of server names.
# Version: 1.1
#
# Example Execution: .\Create_SQLAgentJobSripts.ps1 .\ServerNameList.txt
param([String]$ServerListPath)