Skip to content

Instantly share code, notes, and snippets.

View SlowPlayer.cpp
#define INITGUID
#include <SDKDDKVer.h>
#include <windows.h>
#include <mfidl.h>
#include <mfapi.h>
#include <evr.h>
#include <cguid.h>
#include <propvarutil.h>
#include <comdef.h>
View Client.cs
using Microsoft.Win32.SafeHandles;
using System.Diagnostics;
using System.Text;
using System;
using System.Threading;
namespace COMNET
public class Program
sevaa / RequestTLSCert.ps1
Last active Aug 10, 2022
View RequestTLSCert.ps1
# Requires .NET 4.7.2+ or Core 2.0+
# Basic parameters. For TLS certs for IIS, this is sufficient
$Hostname = "" # Goes into Subject as the CN
$AltHostnames = @("", "", "") # These go into Subject Alternative Name
$DNPostfix = "OU=IT;O=Acme;L=Chicago;S=Illinois;C=US" # What follows the CN in the Subject field. Optional!
$FriendlyName = "foo" # Optional but highly recommended
$TermDays = 3650 # Expiration date for the temporary self-signed cert. The CA will probably override the exp date anyway.
$CSRPath = "c:\\MyCert.csr" # Your path WILL vary.
$SaveUnderLocalMachine = $false # False for current user, true for local machine.
sevaa / MurMur.sql
Last active Jul 7, 2020
MurMurHash64B in MySQL dialect of SQL
View MurMur.sql
drop function if exists MurmurHash64B;
delimiter $$
create function MurmurHash64B(s longblob, seed int unsigned)
returns bigint unsigned
deterministic no sql
declare m int unsigned default 0x5bd1e995;
declare r int default 24;
declare len int default length(s);
sevaa / MurMur.pas
Last active Feb 14, 2020
MurMurHash64B in Pascal
View MurMur.pas
unit MurMur;
function MurmurHash64B(s: PAnsiChar; Len: Integer; Seed: UInt32) : UInt64;
function MurmurHash64B(s: PAnsiChar; Len: Integer; Seed: UInt32) : UInt64;
m = $5bd1e995;
sevaa / Delta.cs
Created Oct 18, 2019
C# wrapper around MSDelta's ApplyDeltaB API
View Delta.cs
class Delta
private struct DELTA_INPUT
public IntPtr lpcStart;
public UIntPtr uSize;
public bool Editable;
sevaa / FromUTF8.sql
Last active Nov 7, 2021
Converting a VARBINARY data block in UTF-8 to a NVARCHAR string in pure Transact-SQL
View FromUTF8.sql
create function dbo.FromUTF8(@s varbinary(max))
returns nvarchar(max)
declare @i int = 1, @n int = datalength(@s), @r nvarchar(max) = N''
declare @c int, @c2 int, @c3 int, @c4 int, @u int
while @i <= @n
set @c = ascii(substring(@s, @i, 1))
sevaa / ImportTFSTable.sql
Last active Jul 31, 2020
Creates a federating view of all instances of a TFS table in a separate database, for cross-collection queries
View ImportTFSTable.sql
CREATE PROC dbo.ImportTFSTable(@Owner varchar(100), @Table as varchar(100), @WithConfig as int = 0)
declare @SQL varchar(max), @FieldSet varchar(max)
set @FieldSet = (select '[' + name + ']' as a from Tfs_DefaultCollection.sys.columns
where [object_id]=object_id('Tfs_Contracts.'+@Owner+'.'+@Table)
order by column_id
for xml path(''))
set @FieldSet = replace(substring(@FieldSet, 4, len(@FieldSet) - 7), '</a><a>', ',')
set @SQL = (select 'select {guid'''+cast(HostId as varchar(36))+'''} as CollID, ' + @FieldSet + ' from [' + replace(substring(DatabaseName, charindex(';', DatabaseName) + 1, 200), '"', '') + '].' + @Owner+ '.' + @Table as a
sevaa / tfsmyscopes.aspx
Created Apr 27, 2018
This page retrieves the scopes for a TFS issued OAuth token
View tfsmyscopes.aspx
<%@ Page Language="C#"%>
<%@ Import namespace="System.IdentityModel.Tokens" %>
Response.ContentType = "text/plain";
string Token;
if((Token = Request.QueryString.Get("Token")) != null)
Response.Write(new JwtSecurityToken(Token).Payload["scp"]);
sevaa / TFS_UploadExt.ps1
Last active Mar 27, 2019
A Powershell script to upload a TFS extension to an on-prem TFS instance with NTLM auth
View TFS_UploadExt.ps1
Add-Type -Assembly "System.IO.Compression.FileSystem"
Add-Type -Assembly "System.Xml"