Skip to content

Instantly share code, notes, and snippets.

View nyteshade's full-sized avatar

Brielle Harrison nyteshade

View GitHub Profile
import Foundation
import SwiftUI
import AppKit
import UniformTypeIdentifiers
/// QEMULauncher: Reads QEMU options from a plist file and launches QEMU with those options
///
/// This application is designed to be placed in App.app/Contents/MacOS/Launcher and will
/// read options from App.app/Contents/Resources/options.plist to launch QEMU.
class QEMULauncher: ObservableObject {
@nyteshade
nyteshade / prep.sh
Last active March 31, 2025 15:43
ALS AWS Quick Setup Script
# Setup nodejs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash
source $HOME/.bashrc
nvm install 23
# Setup prompt
git clone https://github.com/nyteshade/niceps1
cd niceps1/source
sudo gcc -o /usr/local/bin/getCIP getcip.c
cd ..
@nyteshade
nyteshade / currencyinfo.mjs
Last active March 6, 2025 17:46
ECMAScript Intl CurrencyInfo Class
/**
* Working with the ECMAScript {@link Intl} classes can be a trying and
* exhausting experience. Especially when working with currency strings
* for different locales. This class is designed to provide bi-directional
* formatting and detection of currency values in your code and leverages
* the built-in capabilities of most modern backend and browser based
* JavaScript environments.
*
* @example
* // Shorthand formatting to common combos like USD for 'en-US'
@nyteshade
nyteshade / tool.fatgcc.sh
Last active February 4, 2025 17:49
Fat / Universal Compilation for macOS x86_64 + ARM64
function fat() {
local output="${1}"
local files=($(printf "%s\n" "${2}"))
local GCC_ARGS=(${3:-$(printf "%s\n" "-std=c99 -Wall")})
if [ ${#} -eq 0 ]; then
local argfiles='"<\x1b[93mfile1\x1b[39m> <\x1b[93mfileN\x1b[39m>"'
local argopts='"<\x1b[93mgcc-opt1\x1b[39m> <\x1b[93mgcc-optN\x1b[39m>"'
local argout="<\x1b[93moutput-file\x1b[39m>"
@nyteshade
nyteshade / randstr.c
Created February 4, 2025 15:55
Base 62 0-9a-zA-Z RandStr.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
int wal_stricmp(const char *a, const char *b) {
int ca, cb;
do {
@nyteshade
nyteshade / ms.c
Last active January 16, 2025 01:41
ScriptSort - Automatically sort and source scripts in your shell on startup based on their names (C99 C Compiler Required)
/**
* Simple cli command that prints out milliseconds since epoch
*
* If present within $PATH when scriptsort is run, it can be used to
* calculate the time taken to execute a `source /path/to/script`
* execution.
*/
#include <stdio.h>
#include <time.h>
@nyteshade
nyteshade / unpkg
Created January 11, 2025 00:46
unpkg - For extracting .pkg files on the macintosh
#!/bin/zsh
# A functon that shows users how to use the script. It describes
# and offers some help text that appears when invoked without
# parameters.
showUsage() {
local tool="\x1b[1;35munpkg\x1b[22;39m"
printf "${tool} <path-to-package.pkg> <destination-directory>\n\n"
printf "${tool} will attempt to unpackage the \x1b[1m.pkg\x1b[0m file provided,\n"
printf "however, if certain expectations are not met, it will stop and inform\n"
@nyteshade
nyteshade / dynamic_dates.sql
Created September 10, 2024 20:28
Dynamic Dates in Snowflake
-- Step 1: Create the table without generated columns
create or replace table dates (
timestamp_column TIMESTAMP_NTZ PRIMARY KEY
);
-- Create a join table
create or replace table memorable_dates (
id integer autoincrement,
date timestamp_ntz,
@nyteshade
nyteshade / volinfo.sh
Created September 4, 2024 02:15
diskutil volume info
#!/bin/sh
function volInfo() {
# Flags for verbose output
local verbose=false
# Process optional parameters
while (( "$#" )); do
case "$1" in
--show-name | --verbose | -v | -s)
@nyteshade
nyteshade / settings.json
Created July 8, 2024 13:27
APC+ Visual Studio Code Settings
{
"apc.electron": {
"frame": false,
"trafficLightPosition": {"x": 7, "y": 5},
"titleBarStyle": "hidden",
},
"apc.listRow": {
"fontSize": 18
},