Skip to content

Instantly share code, notes, and snippets.

View wholroyd's full-sized avatar

William Holroyd wholroyd

  • Google
  • Raleigh, NC
View GitHub Profile
@wholroyd
wholroyd / gist:6af0c13f5a8c64bc5670
Created October 15, 2014 14:36
Hashing a string into a Guid
// using System.Security.Cryptography
var str = “William Holroyd”;
var byt = Encoding.UTF8.GetBytes(str);
var hash = MD5.Create().ComputeHash(byt);
var guid = new Guid(hash);
// guid will always have a value of "ead7ab16-6d5b-0fa0-73b7-9fe85b675f83"
// for the input of “William Holroyd” provided above. This value will always
@wholroyd
wholroyd / gist:5db7471adcbdb92a2465
Last active August 29, 2015 14:08
Tomcat 7 and higher default config for users
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<user username="tomcat" password="tomcat" roles="tomcat,manager-gui,manager-status,manager-jmx,manager-script"/>
</tomcat-users>
@wholroyd
wholroyd / gist:14a1d071497f10e77674
Last active August 29, 2015 14:09
Ubuntu Setup
# Add Oracle VirtualBox Repository
wget -q -O - http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian trusty non-free contrib" >> /etc/apt/sources.list.d/virtualbox.org.list'
# Add Google Chrome Repository
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
# Add Spotify Repository
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59
<html>
<body onload="GetPromo()">
<SCRIPT LANGUAGE="JavaScript">
function GetPromo() {
var p = "4650";
var a = "47002";
var b = Math.random().toString().substr(3, 5);
var c = Math.random().toString().substr(7, 1);a
prompt("Enjoy your coupon! :)", a + b + p + c);
<html>
<body onload="GetPromo()">
<SCRIPT LANGUAGE="JavaScript">
function GetPromo() {
var p = "24682";
var a = "47000";
var b = Math.random().toString().substr(3, 4);
var c = Math.random().toString().substr(7, 1);
prompt("Enjoy your coupon! :)", a + b + p + c);
@wholroyd
wholroyd / FoundationContext
Last active August 29, 2015 14:17
EntityFramework SavingChanges event
namespace Foundation.Data.Sql.EntityFramework
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using Foundation.Core.Abstractions;
using Foundation.Infrastructure.Common.Data;
public class FoundationContext : DbContext
@wholroyd
wholroyd / EnumerateRemoteCertificates
Created April 2, 2015 15:14
EnumerateRemoteCertificates
X509Store store = new X509Store(@"\\machinename\MY", StoreLocation.LocalMachine);
@wholroyd
wholroyd / kestrel_failure.txt
Created August 4, 2015 14:36
Kestrel failure in Docker
[wholroyd@wholroyd-fedora fake-dnx]$ docker run -i -t a97703ea76ed
System.IO.FileNotFoundException: Could not load file or assembly 'Kestrel' or one of its dependencies. The system cannot find the file specified.
File name: 'Kestrel'
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName,System.Security.Policy.Evidence)
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.Server.ServerLoader.LoadServerFactory (System.String assemblyName) [0x00000] in <filename unknown>:0
at Microsoft.AspNet.Hosting.Internal.HostingEngin
@wholroyd
wholroyd / failure.txt
Created July 31, 2015 23:04
Docker build on a DNX project failing on DNU restore
[wholroyd@wholroyd-fedora fake-dnx]$ docker build .
Sending build context to Docker daemon 2.561 MB
Sending build context to Docker daemon
Step 0 : FROM microsoft/aspnet
---> 3ad193895d0a
Step 1 : COPY /src/fake-dnx /app
---> Using cache
---> 677cc7cb7b1a
Step 2 : WORKDIR /app
---> Using cache
@wholroyd
wholroyd / output.txt
Last active September 17, 2015 02:21
xunit runner hanging after all tests ran/failed/skipped
xUnit.net DNX Runner (64-bit DNX 4.5.1)
Discovering: fake-dnx.tests
Discovered: fake-dnx.tests
Starting: fake-dnx.tests
fake_dnx.tests.HomeControllerTests.TestingTheDnxTestCommand [FAIL]
Assert.True() Failure
Expected: True
Actual: False
Stack Trace:
at fake_dnx.tests.HomeControllerTests.TestingTheDnxTestCommand () [0x00000] in <filename unknown>:0