Skip to content

Instantly share code, notes, and snippets.

@ElectricWarr
ElectricWarr / table.jq
Last active November 13, 2024 02:11
Create a table from any list of JSON objects using jq
# Convert a list of similar objects into a table of values
# Modified from: https://stackoverflow.com/a/77054233/2613780
# Example usage:
# jq --raw-output --from-file table.jq <<< '[ {"a": "able"}, {"b": "bacon"}, {"c": "cradle"} ]'
# Convert all values to strings
map( map_values(tostring) )
# Get column headings
| ( map(keys) | add | unique ) as $column_titles
# Create an object from column_titles where all values are set to null
@ElectricWarr
ElectricWarr / keybase.md
Created February 14, 2020 10:44
Keybase Verification

Keybase proof

I hereby claim:

  • I am electricwarr on github.
  • I am electricwarr (https://keybase.io/electricwarr) on keybase.
  • I have a public key ASDJuqdPMwQx4Q-DPKucDNYUfOMfEvVNhIOktzXsWxDaTAo

To claim this, I am signing this object:

Function ExcelToPDF ($workbook,$PDFdir) {
# Exports all worksheets of a PDF (except "Report" and "Template")
#Function Variables
[string] $filePath
#Set as saved
$workbook.Saved = $true
$xlFixedFormat = "Microsoft.Office.Interop.Excel.xlFixedFormatType" -as [type]
Function MessageBox {
# Quick function for a pop-up message box à la VBA
param(
[string] $messageText,
[string] $messageTitle = ""
)
Add-Type -AssemblyName System.Windows.Forms
If ($messageTitle -ne "") {