Skip to content

Instantly share code, notes, and snippets.

View patriklindstrom's full-sized avatar
🖼️
At home

Patrik Lindström patriklindstrom

🖼️
At home
View GitHub Profile
@patriklindstrom
patriklindstrom / Get-MsdnKeys.ps1
Created July 26, 2017 13:06 — forked from Jaykul/Get-MsdnKeys.ps1
PowerShell + Selenium Demo: Getting Started, and reusing cookies with Invoke-Request
# It might work in 4, but I'm not testing there. Lower you'll have to tweak code
#requires -Version 5.0
param(
# Your Live ID for MSDN login
[Parameter(Mandatory)]
[PSCredential]
[System.Management.Automation.CredentialAttribute()]
$Credential,
# Pick a browser to use. Defaults to Firefox (which doesn't seem to require an external Driver file)
@patriklindstrom
patriklindstrom / Compare-HashTable.ps1
Last active October 5, 2023 22:32
Powershell Set operations like union, except and Intersect between hashtables
$CSharpLinqMojo = @"
using System.Collections.Generic;
using System.Linq;
namespace CompareTool
{
public class DictCompareOnKeyOnly : IEqualityComparer<KeyValuePair<string, string>>
{
public bool Equals(KeyValuePair<string, string> x, KeyValuePair<string, string> y)
{
return x.Key.Equals(y.Key);
@patriklindstrom
patriklindstrom / FindPrivateKey.cs
Last active September 26, 2016 21:01 — forked from haf/gist:5629584
Finding the private key of a Windows certificate from PowerShell/C#.
using System;
using System.Runtime.InteropServices;
using System.IO;
using System.Text;
using System.Security.Cryptography.X509Certificates;
namespace PKI
{
class Results : IEquatable<Results>
{
internal static readonly Results NotFound = new Results
<#
SYNOPSIS
Converts on or many Markdown textfiles to html. Uses githubs restservice.
.DESCRIPTION
All files ending with .txt or md1 or md will recursivly be run against githubs restservice api.github.com/markdown. Default is that it will be put in same directory with htm as extension.
.EXAMPLE
runs .\ConvertFrom-Markdown.ps1 -FilePath readme.md
.EXAMPLE
Pipe directory "C:\projdocumentation" | .\ConvertFrom-Markdown.ps1 -OutputPath "c:\projdoc_html"
.EXAMPLE
@patriklindstrom
patriklindstrom / ClosedXML_Main.cs
Last active August 29, 2015 14:12
Example of ClosedXML handling ÅÄÖ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// to use close xml use nuget Package Manager Console: Install-Package ClosedXML
// example from http://closedxml.codeplex.com/wikipage?title=Showcase&referringTitle=Documentation
// This example is to prove that closedXML has no problem with strings containing å ä ö swedish letters with umlauts and circles.
// it adds person with name Tösse Långbänk
@patriklindstrom
patriklindstrom / RavenDB Map Reduce index Almost
Last active December 23, 2015 14:49
StackOverFlowQuestion about how to express a question for left self join in Raven DB. To explain what I want I use T-SQL. Below Example of RavenDB map reduce index that almost does it.
public class PageTextElement
{
public string Page;
public string Token;
public string Webtext;
public string Language;
public string Translator;
public DateTime CreationTime;
}