Skip to content

Instantly share code, notes, and snippets.

View Guzzter's full-sized avatar
🏠
Working from home

Guus Beltman Guzzter

🏠
Working from home
View GitHub Profile
@Guzzter
Guzzter / gist:b23ec45c221f3481f8ff
Created May 21, 2014 11:48
Ignore all Visual Studio items for GIT
*.suo
*.user
bin/
_ReSharper.*/
obj/
@Guzzter
Guzzter / Tridion_Event_System_Installer.ps1
Last active September 2, 2015 12:35
Tridion Event System Installer script for deployment automation
write-output "/***
* _____ _ _____ _
* | ___| | | / ___| | |
* | |__ __ __ ___ _ __ | |_ \ `--. _ _ ___ | |_ ___ _ __ ___
* | __| \ \ / / / _ \| '_ \ | __| `--. \| | | |/ __|| __| / _ \| '_ ` _ \
* | |___ \ V / | __/| | | || |_ /\__/ /| |_| |\__ \| |_ | __/| | | | | |
* \____/ \_/ \___||_| |_| \__| \____/ \__, ||___/ \__| \___||_| |_| |_|
* __/ |
* |___/
* _____ _ _ _
@Guzzter
Guzzter / IndentXml.ps1
Created July 30, 2015 08:58
Script to indented an unformatted XML file
# Script to indented an unformatted XML file
# Usage: .\IndentXml.ps1 -xmlfile .\ugly.xml
param (
[string]$xmlfile = $(throw "-xmlfile is required."),
[int]$indent = 2
)
function Format-XML ([xml]$xml, $indent=2)
{
$StringWriter = New-Object System.IO.StringWriter
@Guzzter
Guzzter / InstalledExtensionsReporter.ps1
Created July 30, 2015 11:03
Scans Tridion CMS for installed extensions and create a report with version numbers. (Useful for comparing DTAP systems)
$ExportFile = $env:TRIDION_HOME + 'web\report.html'
$LocationEventSystem = $env:TRIDION_HOME + 'EventSystem\'
$LocationCustomPages = $env:TRIDION_HOME + 'web\CustomPages\'
$LocationGuiExtensions = $env:TRIDION_HOME + 'GuiExtensions\'
$Title = "Installed Tridion Extensions"
$guiExtension = Get-ChildItem -Path $LocationGuiExtensions | Select Name, LastWriteTime | ConvertTo-Html -Fragment
$customPagesDetailed = Get-ChildItem -Recurse -Path $LocationCustomPages *.dll | Select-Object -ExpandProperty VersionInfo | Select FileName, FileVersion | ConvertTo-Html -Fragment
$customPages = Get-ChildItem -Path $LocationCustomPages | Select Name, LastWriteTime | ConvertTo-Html -Fragment
@Guzzter
Guzzter / CreateAnEnvironmentForMe.cs
Created August 11, 2015 08:50
Create Tridion Environment with coreservice (don't know the author)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Xml.Linq;
using ContentClasses;
using Tridion.ContentManager;
using Tridion.ContentManager.CoreService.Client;
using ItemType = Tridion.ContentManager.CoreService.Client.ItemType;
namespace CreateAnEnvironmentForMe
@Guzzter
Guzzter / webserver.js
Created August 13, 2015 09:13
NodeJS webserver
#!/usr/bin/env node
var util = require('util'),
http = require('http'),
fs = require('fs'),
url = require('url'),
events = require('events');
var DEFAULT_PORT = 8000;
@Guzzter
Guzzter / CLEAN_TRIDION_PUBLISH_TRANSACTIONS.SQL
Created August 31, 2015 15:46
CLEAN_TRIDION_PUBLISH_TRANSACTIONS.SQL
/*
This script is setup to delete data from PUBLISH_TRANSACTIONS table at a certain specified interval
to keep the table with latest information while purging old data. After the execution of this script
only 30,000 rows will be preserved in the table.
DELETES are performed at chunks of 1000 rows to prevent table locking
10/6/2014: Verified to be working on SDL Tridion 2013 SP1 database
*/
@Guzzter
Guzzter / testurls.sh
Created September 3, 2015 13:59
Bash script to test url and log the http response codes
#!/bin/sh
input=list.txt
output=urls_result.txt
siteprefix=https://www.site.com
rm -rf $output
while read LINE
do
@Guzzter
Guzzter / ReplaceRecursive.ps1
Created September 3, 2015 14:00
Recursively replace text in config files
$configFiles=get-childitem . config.xml -rec
foreach ($file in $configFiles)
{
Write-Host "Processing file" $file.FullName
(Get-Content $file.PSPath) | Foreach-Object {$_ -replace "MaxSize=""10000000""", "MaxSize=""20000000"""} | Set-Content $file.PSPath
}
@Guzzter
Guzzter / EnumHelper.cs
Created December 8, 2015 14:07
Enum helper class to convert a string to enum
public static class EnumHelper<T>
{
public static T Parse(string value)
{
return EnumHelper<T>.Parse(value, true);
}
public static T Parse(string value, bool ignoreCase)
{
return (T)Enum.Parse(typeof(T), value, ignoreCase);