Skip to content

Instantly share code, notes, and snippets.

@Aaron-P
Aaron-P / beyond-compare-spectrogram.md
Last active July 10, 2022 01:17
Beyond Compare Audio Spectrogram File Format
@Aaron-P
Aaron-P / UUIDv4.js
Created July 5, 2021 01:27
JavaScript UUID v4 generation
function UUIDv4() {
const bytes = new Uint8Array(16);
window.crypto.getRandomValues(bytes);
bytes[6] = (bytes[6] & 0x0f) | 0x40;
bytes[8] = (bytes[8] & 0x3f) | 0x80;
// Is there a better way of getting our string from the byte array?
const hex = bytes.reduce((output, byte) => (output + ("0" + byte.toString(16)).slice(-2)), "");
return `${hex.substring(0, 8)}-${hex.substring(8, 12)}-${hex.substring(12, 16)}-${hex.substring(16, 20)}-${hex.substring(20, 32)}`;
}
@Aaron-P
Aaron-P / private_fork.md
Created May 13, 2020 21:52 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@Aaron-P
Aaron-P / .gitignore
Created May 7, 2017 21:33
Insert git revision information into compiled project, output in elmah logs, and require changes to be commited for release builds.
# Ignore the auto-generated file or there will be a loop of uncommitted changes.
**/Properties/AssemblyInfoGit.cs
@Aaron-P
Aaron-P / ElmahHttpAuthFilter
Last active February 3, 2018 12:48
Remove http basic auth headers from elmah logs.
protected void ErrorLog_Filtering(object sender, Elmah.ExceptionFilterEventArgs e)
{
var request = System.Web.HttpContext.Current.Request;
var auth = request.ServerVariables["HTTP_AUTHORIZATION"];
if (!String.IsNullOrEmpty(auth))
{
var authPattern = new Regex(@"(Authorization|HTTP_AUTHORIZATION):\s*" + auth + @"\s*", RegexOptions.ExplicitCapture);
request.ServerVariables["ALL_HTTP"] = authPattern.Replace(request.ServerVariables["ALL_HTTP"], String.Empty);
request.ServerVariables["ALL_RAW"] = authPattern.Replace(request.ServerVariables["ALL_RAW"], String.Empty);
}