Skip to content

Instantly share code, notes, and snippets.

@SpaceShot
SpaceShot / Create-Key-Pair-Azure.md
Last active August 2, 2022 13:15
Creating a public/private key pair and storing in Azure

In the Azure Cloud Shell or Azure CLI

Set variables

RESOURCE_GROUP=cg-rsakeys-test RESOURCE_GROUP_LOCATION=westus KEY_VAULT_NAME=cg-rsakeys-test-kv

Create a resource group to use

az group create -l $RESOURCE_GROUP_LOCATION -n $RESOURCE_GROUP
@SpaceShot
SpaceShot / index.html
Created January 8, 2022 23:28
JavaScript Code - WCTD 2022 sample
<!-- Add a simple greeting to your page-->
<p>
Name: <input type="text" id="users-name" /><br />
<button id="pressme" type="button">Click here</button>
</p>
<p id="greeting"></p>
<!-- Add two numbers -->
<p>
<input type="number" id="number1" /> +
@SpaceShot
SpaceShot / Enable Windows Native OpenSSH.md
Last active February 16, 2022 17:06
Using Native OpenSSH Client in Windows 10

Using Native OpenSSH Client in Windows 10

Overview

Some time ago I needed to ssh into a Linux machine. For eons, a common way to do this way to use PuTTY. The point of this is not to discourage you from using PuTTY. PuTTY is fantastic.

So I had two motivations for checking out the native OpenSSH client in Windows 10:

  1. I heard SSH was now a native, but optional feature.
  2. Using PuTTY is very much a "Windows" thing to do. I wanted to gain a little of that "command line" speed and zen by being able to SSH in from any command prompt.

Why not Git Bash?

The vast majority of developers have Git on their machine and it probably shipped with Git Bash. Many developers erronesouly believe you can only use Git through Git Bash. This is an unnecessary practice that I think really slows you down.

@SpaceShot
SpaceShot / GitLogLive.ps1
Created November 17, 2016 15:50
Git Live updates with PowerShell
# could make this an argument
cd C:\testing\poems
DO
{
clear
# could use where to figure out where git is instead of hardcoding
C:\Users\cgomez\AppData\Local\GitHub\PortableGit_284a859b0e6deba86edc624fef1e4db2aa8241a9\cmd\git.exe log --oneline
Start-Sleep -s 1.4
}
WHILE (1 -eq 1)
@SpaceShot
SpaceShot / AudioLoopWithDelay.cs
Created February 13, 2015 12:11
Sample Unity Coroutine that loops a audio clip with a delay between plays
using UnityEngine;
using System.Collections;
public class AudioLoopWithDelay : MonoBehaviour {
public float Delay = 5.0f;
// Use this for initialization
void Start () {
StartCoroutine(YourFunctionName());
}
@SpaceShot
SpaceShot / index.html
Created August 26, 2014 19:48 — forked from anonymous/index.html
Pointer Events Demonstration
<span id="support">No multi-touch support</span><br>
<canvas id="drawSurface" width="500px" height="500px" style="border:1px solid black;"></canvas>
Turn on Xbox One
Start Forza 5
Wipe Game Save by holding shoulder buttons/bumpers, press Y and accept.
Uninstall Forza 5 Game from console.
Go to Settings > Blu Ray and clear persistent cache.
Turn off Xbox One by holding down power button until it beeps.
Unplug Xbox One for at least ten minutes (might be longer)
Plug in Xbox One and start up.
Start install of Forza 5.
Turn off console and wait for at least six hours, preferably more (through my workday)
@SpaceShot
SpaceShot / bouncing_clown_snippet2.cs
Created August 13, 2012 12:22
Calculate Bounce based on where the clown hits for breakout style returns
// calculate bounce based on distance from clown center to trampoline center
int angle = trampolineRectangle.Center.X - clownRectangle.Center.X + 90;
float newY = 800 * (float)Math.Sin(MathHelper.ToRadians((float)(angle)));
float newX = 800 * (float)Math.Cos(MathHelper.ToRadians((float)(angle)));
clown.Velocity.X = newX;
clown.Velocity.Y = newY;
@SpaceShot
SpaceShot / bouncing_clown_snippet1.cs
Created August 13, 2012 12:20
Calculate angle at which clown bounces back up
int angle = trampolineRectangle.Center.X - clownRectangle.Center.X + 90;
@SpaceShot
SpaceShot / gist:3152437
Created July 20, 2012 18:28
Linq query with customer order by to an anonymous type
XdsServicesDataContext xds = new XdsServicesDataContext();
var query = xds.SXAXDSCustomers.AsEnumerable().OrderBy(c => c.Oid, new OidComparer())
.Select( x =>
new {
Name = x.Name,
Oid = x.Oid,
UserId = x.UserId,
AllowAutoPatientRegistration = x.AllowAutoPatientRegistration,
MembershipUsersCollection = Membership.FindUsersByName(x.UserId)