Skip to content

Instantly share code, notes, and snippets.

View jtucker's full-sized avatar
💭
Home Office

Jason Tucker jtucker

💭
Home Office
View GitHub Profile
@jtucker
jtucker / movie-premier.fs
Created November 23, 2022 14:56
Movie Premier Challenge
// There are 2 types of tickets, blue tickets for regular attendees and golden tickets for VIP access
// Requirements
// People should enter the movie in the order they arrived
// Golden ticket holders should enter first
// Both blue ticket and golden tickets holders can enter any time before minute 30 of the movie
// No one should enter before 1 hour prior to movie start
open System
type Ticket =
| Golden
@jtucker
jtucker / role_assignments.bicep
Created March 23, 2022 14:44
Create required role assignments for the Policy remediation
resource monitoringContributorAssignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
name: guid(subscription().id, 'st-logs-to-law', '749f88d5-cbae-40b8-bcfc-e573ddc772fa')
properties: {
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '749f88d5-cbae-40b8-bcfc-e573ddc772fa')
principalType: 'ServicePrincipal'
principalId: initiativeDefinitionPolicyAssignment.identity.principalId
}
}
resource logAnalyticsContributorAssignment 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {
@jtucker
jtucker / remediate_task.bicep
Last active March 23, 2022 14:47
Bicep code for creating a remediation task
@description('Policy Definition Resource ID to create remediation task for.')
param remediatePolicyId string
@description('The Policy Definitions that were applied')
param policyDefinitions array
@description('The Policy Assignment ID')
param policyAssignmentId string
resource remediateTask 'Microsoft.PolicyInsights/remediations@2021-10-01' = [for definition in policyDefinitions: if (remediatePolicyId == definition.policyDefinitionId) {
name: guid('Remediate', definition.policyDefinitionReferenceId, subscription().id)
properties: {
@jtucker
jtucker / create-policy-set.bicep
Last active March 23, 2022 14:44
Policy Intiative
// get the log analytics workspace for the policy
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-06-01' existing = {...}
resource policyDefinition 'Microsoft.Authorization/policySetDefinitions@2020-09-01' = {
name: 'Test Azure Policy'
properties: {
...
parameters: {
logAnalyticsWorkspace: {
type: 'String'
@jtucker
jtucker / .gitignore
Last active August 17, 2021 20:33
F# Solution to the Social Distancing algorithm challenge.
bin/
obj/
@jtucker
jtucker / .\update-readme.fsx
Created March 11, 2021 20:40
F# script to merge the parsed JSON and the README.asciidoc
#r "nuget: FSharp.Data"
open System.IO
open System.Text.RegularExpressions
open FSharp.Data
let currentDirectory = System.Environment.CurrentDirectory
let readmeLocation = Path.Join(currentDirectory, "README.asciidoc")
let replaceTextInGroup (currentText: string) replaceText (group: Group) =
currentText.Replace(group.Value, $"{System.Environment.NewLine}{replaceText}{System.Environment.NewLine}")
@jtucker
jtucker / .\untappd.yml
Last active March 11, 2021 20:57
Workflow for adding Untappd checkins to profile README
name: Untappd README Update
on:
schedule:
- cron: '0 */1 * * *'
workflow_dispatch:
jobs:
get_activities:
name: Get the latest activity feed
@jtucker
jtucker / Isogram.fs
Created October 31, 2020 18:42
Determine if a string is an isogram
module Isogram
let isIsogram str =
let cleanString (word: string) = word.ToLower().Replace("-", "").Replace(" ", "")
let getCharCount word = word |> Seq.toList |> Seq.countBy(id)
let hasDuplicates charCounts = not (Seq.exists (fun (_, v) -> v > 1) charCounts)
str |> (cleanString >> getCharCount >> hasDuplicates)
@jtucker
jtucker / blazor-sass-scoped.csproj
Last active August 10, 2020 19:57
Blazor scoped CSS & SASS compiling.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<UseBlazorWebAssembly>true</UseBlazorWebAssembly>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0-rc.1.20405.9" />
@jtucker
jtucker / blazor-scoped.csproj
Last active August 9, 2020 15:56
Simple .Net 5 project file & nuget.config
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<UseBlazorWebAssembly>true</UseBlazorWebAssembly>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0-rc.1.20405.9" />