This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Ad Hoc IIS Log analysis | |
-- Based on code from http://support.microsoft.com/kb/296085 | |
-- Updated to work with the IIS log column config from my | |
-- particular inherited Windows 2008 server. | |
-- | |
DROP TABLE #IISLogs | |
GO | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Copyright (c) 2011 Justin Dearing ([email protected]) | |
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) | |
* and GPL (http://www.opensource.org/licenses/gpl-license.php) version 2 licenses. | |
* This software is not distributed under version 3 or later of the GPL. | |
* | |
* Version 1.0.0-RC1 | |
* | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- First we create a login from our user | |
CREATE LOGIN [domain\justin.dearing] FROM WINDOWS; | |
GO | |
-- Now we make him sysadmin | |
EXEC sp_addsrvrolemember | |
@rolename='sysadmin', | |
@loginame='domain\justin.dearing' | |
GO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Created a simple table for storing state names and postal abbreviations. | |
SET NOCOUNT ON; | |
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[States]') AND type in (N'U')) | |
DROP TABLE [dbo].[States] | |
GO | |
CREATE TABLE States ( | |
Name varchar(30) NOT NULL, --The largest "state" name is 'FEDERATED STATES OF MICRONESIA' which is exactly 30 characters long |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName "System.Web" | |
# Powershell function to iterate through all the branches of a | |
# Visual Studio Solution in SVN, and return the file names in particular subfolders of the database project | |
# Assumes the command line svn client is in the system path | |
function Get-ReleaseScripts ( | |
[string] $branchRoot, | |
[string] $subProject, | |
[string[]] $scriptFolders = ('Ad Hoc Scripts', 'Release Scripts') | |
) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [master] | |
GO | |
IF EXISTS (SELECT name FROM sys.databases WHERE name = N'TestAssembly') | |
BEGIN | |
ALTER DATABASE [TestAssembly] SET OFFLINE WITH ROLLBACK IMMEDIATE; | |
ALTER DATABASE [TestAssembly] SET ONLINE; | |
DROP DATABASE [TestAssembly]; | |
END | |
GO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adjust these per your environment | |
[string] $AtlantisSchemaEngineBaseDir = 'F:\src\Atlantis.SchemaEngine\'; | |
[string] $SqlServerInstance = 'localhost\SQLEXPRESS2k8R2'; | |
[string] $dbName = 'master' | |
# This line works: | |
Add-Type -Path "$($AtlantisSchemaEngineBaseDir)\Atlantis.SchemaEngine\bin\Debug\Atlantis.SchemaEngine.dll" | |
[string] $cnStr = "Data Source=$SqlServerInstance;Initial Catalog=$dbName;Integrated Security=SSPI;"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We assume that the driver is installed via the MSI. | |
[string] $mongoDriverPath; | |
# Check to see if we are running the 64 bit version of Powershell. | |
# See http://stackoverflow.com/questions/2897569/visual-studio-deployment-project-error-when-writing-to-registry | |
if ([intptr]::size -eq 8) { | |
$mongoDriverPath = (Get-ItemProperty "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx\MongoDB CSharpDriver 1.0").'(default)'; | |
} | |
else { | |
$mongoDriverPath = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx\MongoDB CSharpDriver 1.0").'(default)'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use DateTime; | |
my $dt = DateTime->now(); | |
# We can't call it $7zip because variable names can't begin with a number. | |
#my $lzexe; | |
my $lzexe = get7Zip(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html | |
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms") | |
$file = (get-item 'C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg') | |
#$file = (get-item "c:\image.jpg") | |
$img = [System.Drawing.Image]::Fromfile($file); | |
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274 |
OlderNewer