Skip to content

Instantly share code, notes, and snippets.

View matt40k's full-sized avatar

Matt Smith matt40k

View GitHub Profile
private void SaveCsvAsUTF8(string path)
{
try
{
string fileContent = File.ReadAllText(path);
File.WriteAllText(path, fileContent, System.Text.Encoding.UTF8);
}
catch (IOException ioexception)
{
logger.Log(LogLevel.Error, ioexception);
@matt40k
matt40k / Scrapper.ps1
Created June 11, 2015 09:26
Scraps out the sql table meta data
$ServerName='svr-ehr233'# the server it is on
$Database='scc_test' # the name of the database you want to script as objects
$DirectoryToSaveTo='C:\temp\scriptout\' # the directory where you want to store them
# Load SMO assembly, and if we're running SQL 2008 DLLs load the SMOExtended and SQLWMIManagement libraries
$v = [System.Reflection.Assembly]::LoadWithPartialName( 'Microsoft.SqlServer.SMO')
if ((($v.FullName.Split(','))[1].Split('='))[1].Split('.')[0] -ne '9') {
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMOExtended') | out-null
}
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SmoEnum') | out-null
set-psdebug -strict # catch a few extra bugs
@matt40k
matt40k / SetDev.ps1
Last active August 29, 2015 14:22
Sets the SIMS directory to environment variable - used by Visual Studio during development
Function Get-IniContent {
<#
.Synopsis
Gets the content of an INI file
.Description
Gets the content of an INI file and returns it as a hashtable
.Notes
Author : Oliver Lipkau <oliver@lipkau.net>
@matt40k
matt40k / bomgar.xsd
Created June 11, 2015 09:31
Bomgar audit data
<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="bomgar">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="session">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="u_session_id" type="xs:string" />
<xs:element minOccurs="0" name="u_session_type" type="xs:string" />
@matt40k
matt40k / bomgar.xslt
Created June 11, 2015 09:32
Bomgar audit data
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
<bomgar>
<xsl:for-each select="exit_survey_list/exit_survey">
<session>
<u_session_id>
<xsl:value-of select="@lsid"/>
</u_session_id>
<u_session_type>
@matt40k
matt40k / Build.ps1
Created June 11, 2015 11:03
Builds a combined TSQL script from folders of TSQL scripts (and sub-folders of fragments of TSQL)
################
## VARIABLES ##
################
$projects = @("Project1", "Project2", "Project3")
$dbs = @("Staging", "Warehouse")
$dir = $PSScriptRoot
################
## LOGIC ##
@matt40k
matt40k / gist:07130bab5fc90fe31cc5
Created June 17, 2015 16:04
Disable SSIS component expression
@[User::Disable] == 0 ? (DT_BOOL)true : (DT_BOOL)false
@matt40k
matt40k / gist:d5b226c06c31db651234
Created June 24, 2015 15:03
Postcode format for DQS
A[A]1[1] 1AA
@matt40k
matt40k / BO_CMS_unwanted_reports.sql
Last active August 29, 2015 14:25
Business Objects - unwanted reports
SELECT
*
INTO cms_infoobjects7_temp
FROM
boxicms.cms_infoobjects7
WHERE
schedulestatus != 3
OR schedulestatus IS NULL
@matt40k
matt40k / import_pupil_udf.csv
Last active August 29, 2015 14:26
UDF import for Green Abbey
Adno UDF
004329 A1
004441 A2
003855 A3
004074 A4
003856 A5
004075 A6
004330 A7
003969 A8
003857 A9