Skip to content

Instantly share code, notes, and snippets.

View jbollman7's full-sized avatar

Joseph Bollman jbollman7

  • Northern Colorado
View GitHub Profile
@jbollman7
jbollman7 / gist:9e0974d634750af589f096ee0b01153e
Created April 10, 2017 21:00
Error executing action `run` on resource 'powershell_script[Install Chocolatey]'
ArgumentError
-------------
wrong number of arguments (given 0, expected 1)
PS C:\users\joseph.bollman\Desktop\LABS\Bollman_scripts\dd-windows> kitchen converge -l debug
-----> Starting Kitchen (v1.15.0)
D [Vagrant command] BEGIN (vagrant --version)
D [Vagrant command] END (0m0.00s)
D [Vagrant command] BEGIN (vagrant plugin list)
D [Vagrant command] END (0m0.00s)
@jbollman7
jbollman7 / gist:fdc222694ee1ee9fbdf110f48e89955b
Created April 7, 2021 00:00
vdbench file for 24 hosts, 8 vlans each. 192 sd lines
* 8 vlans, 24 hosts, Each vlan has a test file.
sd=sd1,host=vdbench1,lun=/nfs/3222/testfile1,size=1G
sd=sd2,host=vdbench1,lun=/nfs/3223/testfile1,size=1G
sd=sd3,host=vdbench1,lun=/nfs/3224/testfile1,size=1G
sd=sd4,host=vdbench1,lun=/nfs/3225/testfile1,size=1G
sd=sd5,host=vdbench1,lun=/nfs/3226/testfile1,size=1G
sd=sd6,host=vdbench1,lun=/nfs/3227/testfile1,size=1G
sd=sd7,host=vdbench1,lun=/nfs/3228/testfile1,size=1G
@jbollman7
jbollman7 / BinarySearch.cs
Created May 5, 2021 15:15
Binary Search C#
using System;
namespace BinarySearch
{
class Program
{
static void Main(string[] args)
{
int[] MyArray = new int[]{1,2,3,4,5,6,7};
//Console.WriteLine();
@jbollman7
jbollman7 / json2.dotnet.cs
Created June 15, 2021 00:01
Deserializing Json 2 .net object.
//2 Scenarios. Either returning a list of json objects you can deserailze to .net objects
// OR returning a single json object, but the first property of the object is a list, and inside the list is the value you actually want.
HttpResponseMessage response = await client.GetAsync(targeturl);
response = await client.GetAsync(finalRequestUri);
var content = response.Content;
// ... Read the string.
string json = await content.ReadAsStringAsync();
JObject rss = JObject.Parse(json);
//1st scenario; i am returning an array of json objects, that will later be desearilzed.
@jbollman7
jbollman7 / SslHandle.cs
Created June 15, 2021 00:02
SSL Hanlder. when invalid/selfsigned certs got you down
using System.Net.Http;
using System.Security.Authentication;
namespace Auth_ConnectionLib
{
public static class SslHandle
{
public static HttpClientHandler FixInvalidSsl()
{
var httpClientHandler = new HttpClientHandler
@jbollman7
jbollman7 / gist:9d327fa68b5024e105be10b9e84f9490
Last active October 12, 2021 00:27
Datatable to excel file
using System;
using System.Data;
using ClosedXML.Excel;
using System.Linq;
using System.IO;
namespace datatablepractice
{
class Program
{
@jbollman7
jbollman7 / string2binary.cs
Created December 13, 2021 16:12
Convert string to binary
foreach (char ch in MESSAGE)
result += Convert.ToString((int)ch,2);
@jbollman7
jbollman7 / SQLServer-API-setup.md
Last active December 18, 2021 22:13
Connecting to Sql server tshooting

Running "dotnet ef migrations add InitialCreate; dotnet ef database update" Will likely fail. Below is some tips on actually connecting

In appsettings.json

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
 "Microsoft.AspNetCore": "Warning"
@jbollman7
jbollman7 / gist:b3cb5ffd72e15f2070418c8e6931aea9
Created January 3, 2022 22:18
Split Join JS to C# equivalent.
console.log(readline().split(' ').reverse().join(' ')); //JS taking string input, splitting on whitespace, reversing the order of the string array, and joining the array back to a single string.
//Below is the c# equivalent
var t = input.Split(' ').Reverse();
var reversedstring = String.Join(' ', t); //Join is a static method, so I cannot chain like JS.
Console.WriteLine(reversedstring);
@jbollman7
jbollman7 / Checksum-checker.ps1
Created April 1, 2022 20:05
[Windows] Get checksums of all files in a directory
$folderPath = get-childitem -path "C:\Program Files (x86)\Mortgage Cadence\Binaries";
$csvOutputName = "C:\Users\joseph.bollman\Documents\test-.csv";
#make a hash table adn then export hash table at the end?
$fileHashtable = @{}
foreach ($file in $folderPath)
{
$temp = certutil -hashfile $file.Name MD5
$value = $temp[1] -replace '\s+', '' #remove whitespace in hash found in < 2016
$fileHashtable.Add($file, $value)