Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View brucevanhorn2's full-sized avatar
💭
I may be slow to respond.

Bruce M. Van Horn II brucevanhorn2

💭
I may be slow to respond.
View GitHub Profile
@brucevanhorn2
brucevanhorn2 / README.md
Created February 9, 2023 01:17
SQL Server Connectivity Test Script

SQL Server Database Connectivity Tester

OK so you just made a SQL database somewhere... A VM, in the cloud, whatever. Then you made an app server somewhere else and you want to make sure the app server vm can actually access the database. This little script tests the ability to connect, do some basic CRUD, then cleans up after itself.

This is helpful if you run into problems and you need to rule out connectivity to the database.

You need Python3 and pymssql to make it work.

@brucevanhorn2
brucevanhorn2 / README.md
Created December 16, 2022 22:33
VSI 5 Enterprise Summary Export - 12 Months of Data

VSI 5 Enterprise Summary Export - 12 Months of Data

This gist contains a few exmaples of how to export your VSI data. In particular, 12 months of enterprise summary data. You can export to either a CSV file or a JSON file allowing you to then import the data into any analytics tool you choose.

This is a RESTful API call, so you need to create a script that can make an HTTP POST request to https://vsi5.visualstorageintelligence.com/api/export/v1/enterprise_summary_12_months. The payload you post should be in JSON format and should contain the following key value pairs:

output_format: "csv" or "json" request_user: the email address you use to login to VSI request_password: the password you use to login to VSI

VSI 5 Business Unit Forecast by Data Center Export

This REST api call allows you to export your company's business unit forecast by data center. You need to send an HTTP POST to https://vsi5.visualstorageintelligence.com/api/export/v1/get_bu_forecasting along with the folloing parameters in JSON format:

export_format : "json" or "csv" request_date : formatted as mm-dd-yyyy such as 11-04-2022 request_user : the email address you use to login to VSI request_password : the password you use to login to VSI

In this gist, we have a curl script, a PowerShell script, and a Python 3 script to help with automated retrieval.

@brucevanhorn2
brucevanhorn2 / README.md
Last active November 29, 2022 17:45
See all the updates for my projects in git

Latest Update Report

Your scrum master says

Knock knock

Who's there?

Water

@brucevanhorn2
brucevanhorn2 / vsi5-export.py
Created November 10, 2022 18:08
VSI 5 Enterprise Summary Export (Python 3 Version)
import http.client
import json
conn = http.client.HTTPSConnection("vsi5.visualstorageintelligence.com")
payload = json.dumps({
"export_format": "json",
"request_date": "10-31-2022",
"request_user": "your email here",
"request_password": "your password here"
})
@brucevanhorn2
brucevanhorn2 / vsi-export.ps1
Created November 10, 2022 18:07
VSI 5 Enterprise Summary Export (PowerShell 7 Version)
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$body = "{
`n `"export_format`": `"json`",
`n `"request_date`": `"10-31-2022`",
`n `"request_user`": `"your email address here`",
`n `"request_password`": `"your password here`"
`n}"
@brucevanhorn2
brucevanhorn2 / gist:4be9e3dfd38dd6ef074d983e1c261b41
Created November 10, 2022 18:05
Use the VSI 5 REST API to export your Enterprise Summary Data (cURL verion)
curl --location --request POST 'https://vsi5.visualstorageintelligence.com/api/export/v1/enterprise_summary' \
--header 'Content-Type: application/json' \
--data-raw '{
"export_format": "json",
"request_date": "10-31-2022",
"request_user": "your email here",
"request_password": "your password here"
}'
@brucevanhorn2
brucevanhorn2 / README.md
Created October 7, 2022 04:32 — forked from djfdyuruiry/README.md
WSL 2 - Enabling systemd

Enable systemd in WSL 2

NOTE: There is now an official way to do this in WSL 2, use it if possible - see MS post here

This guide will enable systemd to run as normal under WSL 2. This will enable services like microk8s, docker and many more to just work during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.

  • To enable systemd under WSL we require a tool called systemd-genie

  • Copy the contents of install-sg.sh to a new file /tmp/install-sg.sh:

@brucevanhorn2
brucevanhorn2 / README.md
Created April 21, 2022 19:36
Use Python to Parse Python Files with Abstract Syntax Tree

Parsing a Python File using Python and the Abstract Syntax Tree

This comes in handy often. I want to do something based on a Python file. Maybe I want to pull all the docstrings out and make a markdown file. Maybe I want generate a script that calls all the functions in a python file. Whatever it is, the abstract syntax tree can help. Here is an example for the first use case: I pull out all the docstrings. We used this to create the documentation for hackathon at Clear Technologies a few years ago.

#!/bin/bash
echo Whosa are yousa?
read yousaIs
echo Nicen to meets you $yousaIs. Messa thinkin weesa bein friends!