Skip to content

Instantly share code, notes, and snippets.

View georgepaoli's full-sized avatar

George Paoli georgepaoli

View GitHub Profile
@georgepaoli
georgepaoli / Manager IIS from ServerManager .NET class
Created August 26, 2016 12:35
Microsoft.Web.Administration in IIS 7
From https://blogs.msdn.microsoft.com/carlosag/2006/04/17/microsoft-web-administration-in-iis-7/
Creating a Site
ServerManager iisManager = new ServerManager();
iisManager.Sites.Add(“NewSite”, “http”, “*:8080:”, “d:\\MySite”);
iisManager.Update();
This basically creates an instance of the ServerManager class and uses the Add method in the Sites collection to create a new site named “NewSite” listening at port 8080 using http protocol and content files are at d:\MySite.
One thing to note is that calling Update is a requirement since that is the moment when we persist the changes to the configuration store.
After running this code you have now a site that you can browse using http://localhost:8080
@georgepaoli
georgepaoli / find_text_in_sp.sql
Created August 25, 2016 18:40
Find text or command in a stored procedure, MSSQL (by Antonin Foller)
-- URL FONT: http://www.motobit.com/tips/detpg_sql-find-text-stored-procedure/
-- =============================================
-- Author: Antonin Foller, www.foller.cz
-- Create date: 2007-09-19
-- Description: Search a text in stored procedure source code.
-- @text - any text to find, search is done by like '%text%'
-- @dbname - database where to search,
-- - if omitted, all databases in the SQL server instance
-- =============================================
ALTER PROCEDURE [dbo].[find_text_in_sp]
@georgepaoli
georgepaoli / sp_async_execute.sql
Created August 25, 2016 18:34
Asynchronous Execution of T-SQL command, MSSQL (by Antonin Foller)
/*
sp_async_execute - asynchronous execution of T-SQL command or stored prodecure
2012 Antonin Foller, Motobit Software, www.motobit.com
URL FONT: http://www.motobit.com/tips/detpg_async-execute-sql/
*/
CREATE PROCEDURE sp_async_execute(@sql varchar(4000), @jobname varchar(200) = null,
@database varchar(200)= null, @owner varchar(200) = null ) AS BEGIN
SET NOCOUNT ON;
declare @id uniqueidentifier