Skip to content

Instantly share code, notes, and snippets.

View brettski's full-sized avatar
👨‍🍳
Experimenting

Brett Slaski brettski

👨‍🍳
Experimenting
View GitHub Profile
@brettski
brettski / random6.js
Created October 27, 2021 16:18
Randomize alpha-numeric string
return Math.random()
.toString(36)
.substr(2, 6)
.toUpperCase(); // e.g. 'CM2JUR'
@brettski
brettski / productDateForge.test.js
Created December 3, 2020 17:11
A test we don't need any longer which I wanted to retain for reference
const product = {
name: 'Our testing product',
description: 'a product object used for testing',
type: 'TICKET',
createdAt: '2020-11-20T15:03:35.219Z',
createdBy: 'auth0|0',
lastUpdatedAt: '2020-11-20T15:03:35.219Z',
lastUpdatedBy: 'auth0|0',
};
@brettski
brettski / gist:a3ea3b992cfa1c81e3ab37fe22ebaa69
Created August 20, 2018 19:53
Create json string in golang
// You can edit this code!
// Click here and start typing.
package main
import (
"fmt"
"encoding/json"
)
func main() {
@brettski
brettski / InSpecNetCoreNotSeenInstalled-InstalledFeatures
Created December 1, 2016 20:33
The installed feature list from the Test Kitchen server
PS C:\Users\Administrator> Get-WindowsFeature | where-object { $_.installed -eq $true }
Display Name Name Install State
------------ ---- -------------
[X] Application Server Application-Server Installed
[X] .NET Framework 4.5 AS-NET-Framework Installed
[X] File and Storage Services FileAndStorage-Services Installed
[X] Storage Services Storage-Services Installed
[X] Web Server (IIS) Web-Server Installed
[X] Web Server Web-WebServer Installed
@brettski
brettski / InspecNetCoreNotSeenInstalled
Created December 1, 2016 20:30
The kitchen log from failed check of Inspec check: describe windows_feature('NET-Framework-Core')
I, [2016-12-01T14:16:30.834891 #15368] INFO -- default-windows-2012R2: -----> Verifying <default-windows-2012R2>...
I, [2016-12-01T14:16:30.970906 #15368] INFO -- default-windows-2012R2: Using `C:/chef-repo/cookbooks/pulse_web/test/recipes/default` for testing
E, [2016-12-01T14:16:52.435799 #15368] ERROR -- default-windows-2012R2: Verify failed on instance <default-windows-2012R2>.
E, [2016-12-01T14:16:52.435799 #15368] ERROR -- default-windows-2012R2: ------Exception-------
E, [2016-12-01T14:16:52.435799 #15368] ERROR -- default-windows-2012R2: Class: Kitchen::ActionFailed
E, [2016-12-01T14:16:52.435799 #15368] ERROR -- default-windows-2012R2: Message: Inspec Runner returns 1
E, [2016-12-01T14:16:52.435799 #15368] ERROR -- default-windows-2012R2: ----------------------
E, [2016-12-01T14:16:52.435799 #15368] ERROR -- default-windows-2012R2: ------Backtrace-------
E, [2016-12-01T14:16:52.436798 #15368] ERROR -- default-windows-2012R2: C:/opscode/chefdk/embedded/lib/ruby/gems/2.3.0/gems/kitchen-inspec-0.16.1/
@brettski
brettski / lcm.rb
Created November 23, 2016 16:14
Lcm recipe, how to stub the not_if?
powershell_script 'Configure the LCM' do
code <<-EOH
Configuration ConfigLCM
{
Node "localhost"
{
LocalConfigurationManager
{
ConfigurationMode = "ApplyOnly"
RebootNodeIfNeeded = $false
@brettski
brettski / default_spec.rb
Created November 21, 2016 20:00
The simple, default rspec file I am trying to get to work with Chef
#
# Cookbook Name:: pulse_web
# Spec:: default
#
# Copyright (c) 2016 The Authors, All Rights Reserved.
require 'spec_helper'
describe 'pulse_web::default' do
let(:chef_run) do