Skip to content

Instantly share code, notes, and snippets.

View MarkRobertJohnson's full-sized avatar

Mark R. Johnson MarkRobertJohnson

  • Axian, Inc.
  • Portland, OR
View GitHub Profile
@MarkRobertJohnson
MarkRobertJohnson / two_osc_synth.html
Created December 31, 2023 23:58
Web Audio Synthesis Starter (two osciallators)
<html>
<!--
A Simple example using sliders to control the frequencies of two oscillators
-->
<body>
<div>
<label for="frequency1">Frequency 1: </label>
<input type="range" id="frequency1" min="0" max="4000" value="600">
<span id="frequency1Value">600</span> Hz
</div>
@MarkRobertJohnson
MarkRobertJohnson / SetMaxEnvelopSizekb.otter
Created September 26, 2018 04:25
Set the MaxEnvelopeSizekb in OtterScript
PSEnsure
(
Key: PowerShell MaxEnvelopeSizekb,
Value: $PowerShell_MaxEnvelopeSizekb,
Collect: "(Get-Item WSMan:\localhost\MaxEnvelopeSizekb).Value",
Configure: "Set-Item WSMan:\localhost\MaxEnvelopeSizekb -Value $PowerShell_MaxEnvelopeSizekb"
);
if(!(Get-Command choco -erroraction SilentlyContinue)) {
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
}
choco install webpicmd -y
$webpicmd = 'webpicmd'
if(!(Get-Command $webpicmd -erroraction SilentlyContinue )) {
$webpicmd = 'C:\Program Files\Microsoft\Web Platform Installer\WebpiCmd.exe'
@MarkRobertJohnson
MarkRobertJohnson / Get-SeqGuid2.ps1
Created January 13, 2018 23:18
Get sequential GUIDs without using Windows DLL.
$c = @"
using System;
public class SequentialGuid {
Guid _CurrentGuid;
public Guid CurrentGuid {
get {
return _CurrentGuid;
}
}
@MarkRobertJohnson
MarkRobertJohnson / Get-SeqGuid.ps1
Created January 13, 2018 23:01
Generates sortable sequential GUIDs
$c = @"
using System;
using System.Runtime.InteropServices;
public static class SeqGuid {
private class NativeMethods
{
[DllImport("rpcrt4.dll", SetLastError=true)]
public static extern int UuidCreateSequential(out Guid guid);
}
@MarkRobertJohnson
MarkRobertJohnson / musicKeys.html
Last active April 7, 2018 15:20
A little polyphonic synthesizer that run in the browser. Uses computer keyboard to trigger notes.
<html>
<header>
<script lang="javascript" >
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var sineTerms = new Float32Array([0, 0, 1, 0, 1]);
var cosineTerms = new Float32Array(sineTerms.length);
var customWaveform = audioCtx.createPeriodicWave(cosineTerms, sineTerms);
#!/bin/bash
#Docker commands taken from: https://inedo.com/support/kb/1100/getting-started-with-proget-for-linux#limitations
brew cask install docker
#Now, go and start start docker from finder
mkdir -pv /private/var/proget/db
mkdir -pv /private/var/proget/packages
@MarkRobertJohnson
MarkRobertJohnson / prop.snippet
Created September 19, 2017 23:25
Visual Studio snippet for TypeScript property setter and getter
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<Header>
<Title>prop</Title>
<Author>Mark R. Johnson</Author>
<Shortcut>prop</Shortcut>
<Description>Code snippet for a property</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
@MarkRobertJohnson
MarkRobertJohnson / CredentialManager.cs
Created August 17, 2016 21:33 — forked from meziantou/CredentialManager.cs
Using the Windows Credential API (CredRead, CredWrite, CredDelete, CredEnumerate)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Win32.SafeHandles;
public static class CredentialManager
{
public static Credential ReadCredential(string applicationName)
@MarkRobertJohnson
MarkRobertJohnson / BLU_Paver
Last active December 31, 2015 20:59
BLU Paving
<#
.SYNOPSIS
This is a BoxStarter script for paving BLU machines
#>
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
#Should we create domain users and groups? or assume their existence?
#Perhaps for now just assume their existence, but add the users to the local groups