Skip to content

Instantly share code, notes, and snippets.

View MatthewSteeples's full-sized avatar

Matthew Steeples MatthewSteeples

View GitHub Profile
@MatthewSteeples
MatthewSteeples / bankholiday.ps1
Created June 2, 2021 10:25
Is today a UK Bank Holiday?
((Invoke-WebRequest https://www.gov.uk/bank-holidays/england-and-wales.json).Content | ConvertFrom-Json).events.Where({ $_.date -eq [DateTime]::Today.ToString("yyyy-MM-dd")}).Count -gt 0
@MatthewSteeples
MatthewSteeples / mousemove.ps1
Created February 26, 2015 19:09
Powershell Script to keep the mouse moving
Add-Type -AssemblyName System.Windows.Forms
while ($true)
{
$Pos = [System.Windows.Forms.Cursor]::Position
$x = ($pos.X % 500) + 1
$y = ($pos.Y % 500) + 1
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y)
Start-Sleep -Seconds 10
}
@MatthewSteeples
MatthewSteeples / gist:d47f2ea58f63cdab1e24
Created February 13, 2015 20:55
Demonstration of Capability propagation
[RequiresCapability("SQL")]
public class TestBaseClass
{
[TestMethod]
public void RunTest1()
{
}
}
[RequiresCapability("ATS")]
@MatthewSteeples
MatthewSteeples / Replace-FileString.ps1
Created October 30, 2014 11:26
Powershell script to find and replace file contents
# Replace-FileString.ps1
# Written by Bill Stewart ([email protected])
# Modified by Matthew Steeples ([email protected]) to enable using the
# -Recurse flag on Get-ChildItem and piping in
#
# Replaces strings in files using a regular expression. Supports
# multi-line searching and replacing.
#requires -version 2
@model DateTime?
@{
string name = ViewData.TemplateInfo.HtmlFieldPrefix;
string id = name.Replace(".", "_");
bool monthEndOnly = ViewBag.MonthEndOnly ?? false;
}
@Html.TextBoxFor(model => model, new { style = "DatePicker" })
<i class="icon-calendar"></i>
@MatthewSteeples
MatthewSteeples / gist:5997144
Last active December 19, 2015 18:18
Delete SqlWorkflowInstanceStore entries
delete from [System.Activities.DurableInstancing].InstanceMetadataChangesTable
delete from [System.Activities.DurableInstancing].InstancePromotedPropertiesTable
delete from [System.Activities.DurableInstancing].InstancesTable
delete from [System.Activities.DurableInstancing].KeysTable
delete from [System.Activities.DurableInstancing].LockOwnersTable
delete from [System.Activities.DurableInstancing].RunnableInstancesTable
delete from [System.Activities.DurableInstancing].ServiceDeploymentsTable
@MatthewSteeples
MatthewSteeples / SeleniumLog
Last active December 19, 2015 09:29
Automated Test
Started ChromeDriver (v2.0) on port 53252
[0.971][INFO]: received WebDriver request: GET /status
[0.972][INFO]: sending WebDriver response: 200 {
"sessionId": "",
"status": 0,
"value": {
"build": {
"version": "alpha"
},
"os": {
@MatthewSteeples
MatthewSteeples / gist:5888722
Created June 28, 2013 22:40
Build 2003 XML reader
var xml = XElement.Load(@"C:\users\matthew\desktop\wmvhigh.xml");
//xml.Element("channel").Elements("item").Dump();
xml.Element("channel").Elements("item")
.Select(a => new
{
Title = a.Element("title").Value,
Url = new Uri(a.Element("enclosure").Attribute("url").Value)
})
@MatthewSteeples
MatthewSteeples / linqpad.cs
Created June 19, 2013 15:49
Pull Skype chat history out into XML and then query it using LinqPad
var xml = XElement.Load(@"C:\users\matthew\desktop\query.xml");
var names = new string[] { "" }; //Full names of participants to look for
var messages = xml.Elements("Table")
.Where(a => names.Any(a.Element("participants").Value.Split(' ').Contains))
.Where(a => a.Element("body_xml") != null)
.Where(a => a.Element("author") != null)
.Select(a => new
{
@MatthewSteeples
MatthewSteeples / gist:5768974
Created June 12, 2013 20:49
Read through properties in a class and find out if they depend on any other properties in the same class
using Mono.Cecil;
using Mono.Cecil.Cil;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication1
{
class Program
{