Skip to content

Instantly share code, notes, and snippets.

View steverhall's full-sized avatar

Steve Hall steverhall

View GitHub Profile
@steverhall
steverhall / toggle_visual_power_bi.js
Last active October 12, 2022 21:19
Toggle display of a Power BI visual based on whether you have selected data or not.
let loadedResolve, reportLoaded = new Promise((res, rej) => { loadedResolve = res; });
let renderedResolve, reportRendered = new Promise((res, rej) => { renderedResolve = res; });
var activePage;
var approveButton, rejectButton;
var selectedData;
// Get models. models contains enums that can be used.
models = window['powerbi-client'].models;
// Embed a Power BI report in the given HTML element with the given configurations
@steverhall
steverhall / csvutil.rs
Last active January 11, 2022 19:30
CSVUTIL Rust version - parses CSV and outputs column widths and info
use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader};
struct Column {
name: String,
length: usize,
largest_line: u32,
column_type: String,
}
@steverhall
steverhall / csvutil.c
Last active January 10, 2022 21:10
Parses CSV file and returns the max column width for each column in the file
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <getopt.h>
#include <ctype.h>
#define TRUE 1
#define FALSE 0
#define MAX_COLUMNS 255
@steverhall
steverhall / Program.cs
Created January 7, 2022 20:30
Analyze large CSV file and print max size of each column
// Assumes there is a header line in first row of file
// Usage: dotnet run <input-csv-file>
// Output is table of column names and the maximum size of that column
// On Macbook Pro, 56 million rows of a 32 column CSV takes approximately 2.5 minutes
using System.Text.RegularExpressions;
using System.Text;
namespace CsvUtility
{
class Program
<html>
<body><canvas id="canvas" height="400" width="400"></canvas>
<script src="build/qrcode.min.js"></script>
<script>
var numeric = "56762909524320603460292437404460312229595326546034602925407728043360287028647167452228092861333145643765314159064022030645045908564355034142454136403706366541713724123638030437562204673740753232392543344332605736015945332161087074242843506006702520603970216410451052413867414568056233433437587721255726376433232603431112110762423843520642073724613011004253567077623010530566372157220730732574580058247112312321042824106724384277112073102857612358250936562040406253330530306973316050431262680862415575254463306034666774262421403904576438127627117631642152270069413372036204427368707570654466581134230524412228393758580853640504615020594107663153390020353652055729096067296207763650354559712803210460210733093022104263075457623643547428084474592659326036360566425041240833264410055928112575576738370743697421506068236765673440354574597059562600302931576058104310532843236973451020
@steverhall
steverhall / CreateJWK.ts
Last active May 10, 2021 16:47
Create a JWK
import jose, { JWK } from 'node-jose';
const encryptionKeyProps = {
"kty": "EC",
"crv": "P-256",
"alg": 'ECDH-ES',
"use": "enc"
}
const signingKeyProps = {
@steverhall
steverhall / send-qrcode.ts
Created March 12, 2021 20:55
Sending a generated PNG in NodeJS/Express
import healthCardQR from 'express';
import * as shc from '../smartHealthCard';
export const create = async (req: healthCardQR.Request, res: healthCardQR.Response) => {
try {
var qrCodeImage = await shc.queryGetQRCode(req.params.id);
// remove data:image prefix in image object
const img = Buffer.from(qrCodeImage.split(",")[1], 'base64');
res.contentType('image/png');
@steverhall
steverhall / app.ts
Created December 5, 2020 21:16
Getting/Setting Typescript class properties dynamically
class Passport {
ecl: string = '';
pid: string = '';
eyr: string = '';
hcl: string = '';
byr: string = '';
hgt: string = '';
iyr: string = '';
cid: string = '';
}
@steverhall
steverhall / ipaddevtools.csv
Last active January 15, 2022 20:23
iPad Dev Tools
Code Editor General Code Editing https://www.panic.com/
Pythonista Python IDE http://omz-software.com/pythonista/
GitHub GitHub Repo Management http://www.github.com
Azure App Azure Resource Management https://azure.microsoft.com/en-us/features/azure-portal/mobile-app/
Continuous C#/F# Development http://continuous.codes/
Adobe XD Design Prototyping https://www.adobe.com/products/xd.html
Playgrounds Swift Playgrounds https://www.apple.com/swift/playgrounds/
RD Client Remote Desktop Client https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-ios
@steverhall
steverhall / postman_test.js
Created July 30, 2020 00:19
PostMan Test script to insert random data into POST
//BODY payload
//{
// "datetime": "{{requesttime}}",
// "requestor": "{{requestor}}",
// "status": "requested",
// "details": "Tutoring on project",
// "rate": "50",
// "requestfree": false,
// "expert": "{{expert}}",
// "repo": "{{repo}}"