Skip to content

Instantly share code, notes, and snippets.

@jamescoxhead
Created February 26, 2016 17:19
Show Gist options
  • Save jamescoxhead/5b86a2d88b19f6726c6d to your computer and use it in GitHub Desktop.
Save jamescoxhead/5b86a2d88b19f6726c6d to your computer and use it in GitHub Desktop.
Linqpad Queries
<Query Kind="Statements">
<Reference>&lt;RuntimeDirectory&gt;\System.Security.dll</Reference>
<Namespace>System.Security.Cryptography</Namespace>
</Query>
string unhashed = "password";
HMACSHA1 hash = new HMACSHA1();
hash.Key = Encoding.Unicode.GetBytes(unhashed);
string hashed = Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(unhashed)));
Console.WriteLine(hashed);
<Query Kind="Statements" />
string regexExpression = @"^https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)$";
string term = "https://vimeo.com/23966422";
Regex regex = new Regex(regexExpression);
Match match = regex.Match(term);
if(match.Success)
{
Console.WriteLine("Match");
}
else
{
Console.WriteLine("No match");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment