Skip to content

Instantly share code, notes, and snippets.

View nyteshade's full-sized avatar

Brielle Harrison nyteshade

View GitHub Profile
@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
},
@nyteshade
nyteshade / HTML.js
Last active April 20, 2024 05:41
ParamParser and HTML
function ship(code) {
const _ne = Object.entries(code)
.reduce((a, [k,v]) => ({ ...a, [k]:v }), {});
const { defaults = {} } = code;
const [_den, _de] = Object.entries(defaults)?.[0];
if (typeof module !== 'undefined' && module.exports) {
module.exports = _ne || {};
}
else if (_den && _de) { globalThis[_den] = _de; }
}
@nyteshade
nyteshade / Simple Export.js
Created April 20, 2024 00:42
Simple snippet of JavaScript to make exporting vanilla javascript easier
function ship(code) {
const _ne = Object.entries(code)
.reduce((a, [k,v]) => ({ ...a, [k]:v }), {});
const { defaults = {} } = code;
const [_den, _de] = Object.entries(defaults)?.[0];
if (typeof module !== 'undefined' && module.exports) {
module.exports = _ne || {};
}
else if (_den && _de) { globalThis[_den] = _de; }
}
(function() {
const HTML = new Proxy(
class HTML {
static create(
name,
content,
style = {},
attributes = {},
webComponentName = undefined,
useDocument = undefined,