Skip to content

Instantly share code, notes, and snippets.

View skull-squadron's full-sized avatar
💭
*aaS unreleased project in Elixir, Rust, Typescript, Kafka, and k8s

🏴‍☠️ 💪📎 skull-squadron

💭
*aaS unreleased project in Elixir, Rust, Typescript, Kafka, and k8s
  • Hill country
View GitHub Profile
@skull-squadron
skull-squadron / filetopcx
Last active October 19, 2025 12:49
any image to PCX converter script helper
#!/usr/bin/env bash
# requires magick from ImageMagick >= 6.5 (7+ is okay too)
# Suppors output to non-pcx formats too:
# --ext .bmp
# Can be sourced by zsh or bash, but only use filetopcx__convert_file or filetopcx__main
filetopcx__tmpdir=
filetopcx__ext='.pcx'
filetopcx__files=()
filetopcx__args=(
-compress RLE
@skull-squadron
skull-squadron / types.rs
Created October 17, 2025 17:43
Rust concrete typed ontology
use serde::{Deserialize, Serialize};
use std::{
collections::{HashMap, HashSet, LinkedList},
convert::From,
hash::{Hash, Hasher},
};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[repr(u8)]
pub enum Literal {
@skull-squadron
skull-squadron / crate-bin-setup
Created October 5, 2025 10:57
Rust setup script to automatically install the correct toolchain, components, and tool crates
#!/usr/bin/env bash
set -eEuo pipefail
# Should live as: {{project}}/bin/setup
# Requires:
# - {{project}}/.config/setup-install-tool-crates.txt
# - {{project}}/rust-toolchain.toml
cd "${TOP_DIR:-$(cd "$(dirname "$0")" && cd .. && pwd)}"
readarray -t packages < <(sed 's/#.*//;/^[[:space:]]*$/d' .config/setup-install-tool-crates.txt)
@skull-squadron
skull-squadron / to_csv.rs
Last active October 5, 2025 09:44
Easy Rust CSV serialization with serde::Serialize
use anyhow::{Result, bail};
use csv::{Writer, WriterBuilder};
use serde::Serialize;
pub trait ToCsv {
fn to_csv(self) -> Result<String>;
fn to_csv_without_header(self) -> Result<String>;
fn to_csv_with_header<I, T>(self, header: I) -> Result<String>
where
I: IntoIterator<Item = T> + Clone,
@skull-squadron
skull-squadron / nest
Last active October 18, 2025 20:28
Nest Thermostat CLI - in Ruby, primitive but functional
#!/usr/bin/env ruby
# frozen_string_literal: true
# ==== MIT License ====
# Copyright © 2025 <copyright holders>
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the “Software”), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or
@skull-squadron
skull-squadron / gcc11-clang17.diff
Last active September 4, 2025 08:40
gcc11-clang17 fix
diff --git a/libcc1/libcc1plugin.cc b/libcc1/libcc1plugin.cc
index e80ecd8f4b35..e58fa55c0f58 100644
--- a/libcc1/libcc1plugin.cc
+++ b/libcc1/libcc1plugin.cc
@@ -31,6 +31,8 @@
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
+#define INCLUDE_MEMORY
@skull-squadron
skull-squadron / hash-checker
Created September 1, 2025 05:22
hash-checker - Generic recursive SHA256 creation and checking utility
#!/bin/sh
# shellcheck disable=2094
set -eu
cd "$(dirname "$0")" || exit 1
hash_file='hashes.txt'
case "${1-}" in
save) find . -type f -print0 ! -name "$hash_file" | sort -z | xargs -0 sha256sum | tee "$hash_file" ;;
@skull-squadron
skull-squadron / command-not-found.sh
Created August 31, 2025 05:14
FreeBSD bash command not found handler
# /etc/profile.d/command-not-found.sh
[ "$BASH" ] || return 0
command_not_found_handle() {
if [[ "$1" = */* ]]; then
local cmd="${1#/}$"
else
local cmd="usr/local/s?bin/$1$"
fi
@skull-squadron
skull-squadron / README.md
Last active August 30, 2025 11:26
Permanent, hassle-free VMware Workstation 17 Autostart fix

VMware Workstation autostart that works

The problem is that VMware Workstation Autostart service doesn't work.

1. Reset the Autostart service back to default so it doesn't run

Start-Process powershell -Verb RunAs "Set-Service -Name VmwareAutostartService -StartupType Manual"
@skull-squadron
skull-squadron / .gitignore
Last active August 28, 2025 21:52
C++ O(1) epoch <-> datetime (requires floating point math)
/testcxx
/testc