Skip to content

Instantly share code, notes, and snippets.

@zippy1981
zippy1981 / Get-DComErrors.ps1
Last active September 18, 2018 18:50
Retrieve DCOM Errors from the Event Log
function Get-ComNameByAppId {
param (
[Guid] $AppId
)
(get-wmiobject -class "Win32_DCOMApplication" -namespace "root\CIMV2" -Filter "AppID = '{$AppId}'").Name
}
Get-EventLog -EntryType Error -LogName System |Where EventID -eq 10016 | % {
$ReplamentStringLength = $_.ReplacementStrings.Length;
$ClassId = $null;
@zippy1981
zippy1981 / RequestTelemetryEnhancingMiddleware.cs
Created June 6, 2018 15:17
Example Application Insights RequestTelemetry enhancement.
public static IApplicationBuilder UseCorrelationProperties(this IApplicationBuilder app)
{
return app.Use(async (context, next) =>
{
var logger = context.RequestServices.GetRequiredService<ILogger<CorrelationProperties>>();
// NOTE: We're using Features and not RequestServices here.
var requestTelemetry = context.Features.Get<RequestTelemetry>();
if (requestTelemetry != null)
{
@zippy1981
zippy1981 / Log4Net.tail.sql
Created February 16, 2016 03:30
Attempt to make a Cursor tail a log file.
USE AlwaysEncryptedSample;
GO
SET NOCOUNT ON;
DECLARE
@Date CHAR(19),
@Thread VARCHAR(255),
@Level VARCHAR(50),
@Logger VARCHAR(255),
@User NVARCHAR(50),

VPN ENabled: 1 1 ms 1 ms 1 ms Wireless_Broadband_Router.home [192.168.1.1] 2 4 ms 4 ms 4 ms lo0-100.NWRKNJ-VFTTP-329.verizon-gni.net [100.8.64.1] 3 9 ms 7 ms 5 ms T1-5-0-4.NWRKNJ-LCR-22.verizon-gni.net [100.41.210.48] 4 * * * Request timed out. 5 8 ms 8 ms 6 ms 0.ae4.GW10.EWR6.ALTER.NET [140.222.230.157] 6 6 ms 8 ms 7 ms teliasonera-gw.customer.alter.net [157.130.91.86] 7 7 ms 7 ms 6 ms cloudflare-ic-301663-nyk-b2.c.telia.net [213.248.77.162] 8 7 ms 7 ms 8 ms 198.41.208.140

@zippy1981
zippy1981 / Program.cs
Created May 2, 2014 14:17
Interface implementation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
interface IDependency
@zippy1981
zippy1981 / SqlScan.ps1
Last active August 29, 2015 13:56
Powersploit + OrcaMDF hacking.
Import-Module PowerSploit
$vssPath = Join-Path $env:TEMP ([Guid]::NewGuid())
#TODO: Magical nuget stuff I talked to Matt about
$orcaMdfCorePath = 'C:\Users\Justin\Documents\Visual Studio 2013\Projects\OrcaMDF\src\OrcaMDF.Core\bin\Debug\OrcaMDF.Core.dll'
$orcaMdfFrameworkPath = 'C:\Users\Justin\Documents\Visual Studio 2013\Projects\OrcaMDF\src\OrcaMDF.Core\bin\Debug\OrcaMDF.Framework.dll'
mkdir $vssPath
Write-Host "Vss Path $vssPath"
@zippy1981
zippy1981 / gist:8046650
Created December 19, 2013 21:38
Example of a pivot table problem
using System;
using System.IO;
using OfficeOpenXml;
using OfficeOpenXml.Table.PivotTable;
namespace ConsoleApplication1
{
internal static class Program
{
private const string INPUT_XLS_URL = "https://nycopendata.socrata.com/api/views/spgx-ssye/rows.xlsx?accessType=DOWNLOAD";
sudo apt-get update
sudo apt-get upgrade outdated
sudo apt-get remove firefox libreoffice-*
sudo apt-get dist-upgrade
# reboot now to get the latest kernel
sudo apt-get install dkms #makes it easier for vm guest additions for your hypervisor of choice to be added
#mow install guest additions
sudo apt-get install terminator vim
# I like a snapshot here
sudo apt-get install openjdk-7-jdk
@zippy1981
zippy1981 / gist:6131449
Created August 1, 2013 13:43
Windows RSAT MSU URLs
http://download.microsoft.com/download/3/0/1/301EC38B-D8BD-40CD-A3B8-3A514A553BE8/Windows6.0-KB941314-x86_en-US.msu
http://download.microsoft.com/download/4/3/F/43FAC524-F605-426E-A2AE-EAD03D264FDE/Windows6.2-KB2693643-x64.msu
http://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu
http://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu
@zippy1981
zippy1981 / DefaultConfig.reg
Last active December 16, 2015 18:19
Here are some functions for setting Visual Studio Merge tools via the registry.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\TeamFoundation\SourceControl]
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\TeamFoundation\SourceControl\Checkin Policies]
"Microsoft.TeamFoundation.Build.Controls"="C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\\\Common7\\IDE\\PrivateAssemblies\\Microsoft.TeamFoundation.Build.Controls.dll"
"Microsoft.TeamFoundation.VersionControl.Controls"="C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\\\Common7\\IDE\\PrivateAssemblies\\Microsoft.TeamFoundation.VersionControl.Controls.dll"
"StanPolicy"="C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Team Tools\\Static Analysis Tools\\StanPolicy.dll"
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0_Config\TeamFoundation\SourceControl\DiffTools]