Skip to content

Instantly share code, notes, and snippets.

View jshinevar's full-sized avatar

James Shinevar jshinevar

View GitHub Profile
//https://stackoverflow.com/questions/273313/randomize-a-listt
private static Random rng = new Random();
public static void Shuffle<T>(this IList<T> list)
{
int n = list.Count;
while (n > 1) {
n--;
int k = rng.Next(n + 1);
T value = list[k];
//https://stackoverflow.com/questions/767999/random-number-generator-only-generating-one-random-number
public static class StaticRandom
{
private static int seed;
private static ThreadLocal<Random> threadLocal = new ThreadLocal<Random>
(() => new Random(Interlocked.Increment(ref seed)));
static StaticRandom()
{
@jshinevar
jshinevar / GCD.java
Last active June 10, 2017 16:38
Greatest Common Divisor Brute Force Method
import java.util.Scanner;
/**
* Created by James Shinevar on 6/10/17.
* james.shinevar@gmail.com
* http://jamesshinevar.com
*/
public class GCDMain {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
@jshinevar
jshinevar / EuclicianGCD.java
Created June 10, 2017 17:22
Euclidean GCD
import java.util.Scanner;
/**
* Created by James Shinevar on 6/10/17.
* james.shinevar@gmail.com
* http://jamesshinevar.com
*/
public class GCDMain {
public static long FinalGCD;
SELECT DISTINCT Code
, MAX(Date) OVER (PARTITION BY Code) Date
FROM QueryTable
@jshinevar
jshinevar / defaultAngularAppPipeline.yml
Created October 24, 2019 03:32
This is the default YAML file created for building an Angular App using Azure DevOps
# Node.js with Angular
# Build a Node.js project that uses Angular.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
@jshinevar
jshinevar / LeagueTrackrAzureTemplate.json
Created December 11, 2019 14:34
The default Azure Resource Manager Template provided by Azure.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"sites_LeagueTrackr_DEV_name": {
"defaultValue": "LeagueTrackr-DEV",
"type": "String"
},
"components_LeagueTrackr_DEV_name": {
"defaultValue": "LeagueTrackr-DEV",
@jshinevar
jshinevar / LeagueTrackrResourceGroup.json
Created December 11, 2019 22:23
ARM Template for the initial resource group
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string"
},
"resourceGroupEnvironment": {
"type": "string"
},
@jshinevar
jshinevar / AzureDevOpsStarterBuildPipeline.yml
Created December 13, 2019 12:51
What the starter pipeline looks like in Azure DevOps
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
@jshinevar
jshinevar / bitbucket-pipelines.yml
Created January 19, 2021 22:04
bitbucket-pipeline for injecting Semantic Version in a Mulesoft pom.xml
pipelines:
branches:
develop:
- step:
name: Get Semantic Version
script:
- git fetch --unshallow || true
- docker pull gittools/gitversion
- docker run --rm -v "$(pwd):/repo" gittools/gitversion /repo -output json -showvariable FullSemVer > version.txt
services: