Skip to content

Instantly share code, notes, and snippets.

View mintsoft's full-sized avatar
💭
Probably alive.

Rob Emery mintsoft

💭
Probably alive.
  • UK
View GitHub Profile
@mintsoft
mintsoft / log.cpp
Created March 10, 2024 09:50
qCritical log out a stack trace from boost::stacktrace
#include <boost/stacktrace.hpp>
// .....
auto re_stacktrace = boost::stacktrace::stacktrace();
for(boost::stacktrace::frame frame: re_stacktrace) {
if(frame.empty() == false) {
qCritical("STACK -- %s %s:%d %d", frame.name().c_str(), frame.source_file().c_str(), frame.source_line(), frame.address());
}
@mintsoft
mintsoft / iPXE_WDS_EFI.md
Last active January 5, 2024 10:42
iPXE + WDS + EFI Boot Menu
@mintsoft
mintsoft / AllResolutions.ps1
Created April 13, 2015 12:30
Powershell for getting all resolutions from all monitors
$pinvokeCode = @"
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
namespace Resolution
{
[StructLayout(LayoutKind.Sequential)]
public struct DEVMODE1
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
@mintsoft
mintsoft / HMRC_IncomeTax_NIC_ExcelOnline.ts
Created August 4, 2023 13:02
Adds functions to calculate income tax and national insurance on raw income
/** @CustomFunction */
function incomeTax(pay: number): number {
var additionalTax = 0;
var higherTax = 0;
var basicTax = 0;
var personalAllowanceToRemove = Math.floor((pay - 100000) / 2);
var defaultPersonalAllowance = 12570;
@mintsoft
mintsoft / Forkinator.ps1
Last active May 24, 2023 17:50
Powershell to run a bunch of commands in new processes, wait until they're all done and output all the stdout/stderr. If one of the commands returns non-0 exit code then entire script returns 1
#To add more commands, hack them into the $commands array:
$commands = @(
@{"cmd" = "D:\Documents\Powershell\battwo.bat"; "args" = "yo"},
@{"cmd" = "D:\Documents\Powershell\batone.bat"; "args" = "yo2"}
);
$jobs = @();
foreach($cmd in $commands) {
$startinfo = new-object System.Diagnostics.ProcessStartInfo
$startinfo.FileName = $cmd.cmd;
@mintsoft
mintsoft / GetDellWarranty.gs
Last active December 19, 2019 16:42
GetDellWarranty V5 From TechDirect for GScript/Google Sheets
/*
* Returns Dell Warranty for service tag using APIKey
*
* @param {apiKey} API Key from techdirect
* @param {serviceTag} the ServiceTag desired
* @param {headers} Include headers in output
* @return The description and warranty status
*/
function getDellWarranty(clientId, clientSecret, serviceTag, headers) {
@mintsoft
mintsoft / GMail - MAAR.js
Last active March 16, 2019 16:41
GMail - HTML - Mark Page As Read
// ==UserScript==
// @name GMail - Mark Page As Read
// @namespace gmail
// @include https://mail.google.com/*
// @version 1
// @grant none
// ==/UserScript==
(function() {
'use strict';
@mintsoft
mintsoft / inspect.sh
Created July 10, 2013 10:29
Inspect Remote SSL Certificate using openssl
#!/bin/bash
[[ -n "${1}" ]] && openssl x509 -in <( echo "GET /" | openssl s_client -connect ${1}:443 2>&1 | grep -A 65535 'Server certificate' | tail -n+2 | grep -B 65535 'END CERTIFICATE' ) -noout -text -purpose
@mintsoft
mintsoft / convert_pfx_to_pem.sh
Last active October 24, 2016 07:21
Wrapper around openssl for converting pkcs12 certificates exported out of IIS into unencrypted x509 for Apache
#!/bin/bash
[[ -z "$1" ]] && echo "Please specify a .pfx file!" && exit 1;
#combined format:
openssl pkcs12 -in "$1" -out "${1%.pfx}.key_cert.pem" -nodes
#extract certificate/public key
openssl x509 -in "${1%.pfx}.key_cert.pem" -out "${1%.pfx}.cert"
@mintsoft
mintsoft / Screenshot.ps1
Created April 27, 2016 23:48
Screenshot.ps1
[Reflection.Assembly]::LoadWithPartialName("System.Drawing")
function screenshot([Drawing.Rectangle]$bounds, $path) {
$bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height
$graphics = [Drawing.Graphics]::FromImage($bmp)
$graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)
$bmp.Save($path)
$graphics.Dispose()