Skip to content

Instantly share code, notes, and snippets.

View mikesmullin's full-sized avatar
🛴
woot!

Mike Smullin mikesmullin

🛴
woot!
View GitHub Profile
@mikesmullin
mikesmullin / game__common__ECS.c
Created May 27, 2025 01:07
Mike's Fast ECS v1.0.0-alpha (static C impl)
// this is the ECS lib
// Generational Index
// assemble an entity id
inline GID GI_eid(bool pair, CID gen, CID arch, CID arch_idx) {
return //
(pair ? PAIR_BIT : 0U) | //
((u32)gen << GEN_SHIFT) | //
((u32)arch << ARCH_SHIFT) | //
@mikesmullin
mikesmullin / spotify_js.md
Created May 7, 2025 23:12
Spotify Javascript Automation

Spotify Javascript Automation

I'm doing this because Spotify has an annoying bug, where it cannot set the volume properly when I click (it instead picks a random low-numbered value like 0.23, than the one I chose 0.9.)

  1. open devtools (F12) > debugger > search
  2. search for:

this._harmony.setVolume

@mikesmullin
mikesmullin / vbox_vm_core_analysis.md
Last active May 7, 2025 19:49
HOWTO: VirtualBox VM Pause, Core-dump, and Root-Cause Analysis (w/ Volatility3)

HOWTO: Snapshot & Analyze a VBox VM

VBoxManage controlvm "k8s-ctl3" pause

VBoxManage debugvm "k8s-ctl3" dumpvmcore --filename ~/k8s-ctl3-core.dump

user@FAFB09C2:~$ VBoxManage debugvm "k8s-ctl3" getregisters --cpu 0 rip
rip = 0xffffffff81ddde2b
user@FAFB09C2:~$ VBoxManage debugvm "k8s-ctl3" getregisters --cpu 1 rip
@mikesmullin
mikesmullin / defer.c
Created April 13, 2025 19:13
Example of defer in C
#include <stdio.h>
#include <stdlib.h>
int do_something(const char *filename) {
FILE *file = NULL;
char *buffer = NULL;
int result = -1;
file = fopen(filename, "r");
if (!file) {
@mikesmullin
mikesmullin / promiseBatch.js
Created February 18, 2024 05:13
javascript parallel async promise races in batches
const promiseBatch = async function* (concurrency, list, fn) {
for (let p = [], i = 0, l = list.length; i < l || p.length > 0;) {
if (i < l) {
let _p;
_p = fn(list[i]).then(r => [_p.__id, r]);
_p.__id = i++;
if (p.push(_p) < concurrency) {
continue;
}
}
@mikesmullin
mikesmullin / PureRef.md
Created January 2, 2023 18:17
PureRef for artists

PureRef

It's good software.

https://www.pureref.com/

Description

All your reference images in one place. Organize your inspiration and speed up your creative process with PureRef.

@mikesmullin
mikesmullin / nc_reverse_tcp.rb
Created September 27, 2021 00:03
Metasploit: Payload: TTY Command Shell, Reverse TCP (Netcat) w/ AutoVerifySession=false to prevent echo test on connect
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
# /usr/share/metasploit-framework/modules/payloads/singles/generic/nc_reverse_tcp.rb
# usage:
# # launch hostile listener
# $ sudo nc -vlp 80 -ns 192.168.119.198
@mikesmullin
mikesmullin / solitare.js
Created November 9, 2019 16:46
Solitare Solver for MOLEK-SYNTEZ game
(async () => {
const orderedSet = ['6','7','8','9','10','V','D','K','T'];
const nextAbove = c =>
orderedSet[orderedSet.indexOf(c) + 1];
let moveHistory = [];
const analyze = (state) => {
let moves = [];
@mikesmullin
mikesmullin / saml-x509-pki-parsing.js
Created July 18, 2018 04:38
Parsing SAML x.509 Certificate in pure-Javascript
const _idpX509Cert = _.get(resp, ['samlp:Response', 'Assertion', 0,
'ds:Signature', 0, 'KeyInfo', 0, 'ds:X509Data', 0, 'ds:X509Certificate', 0]);
const asn1js = require('asn1js');
const pkijs = require("pkijs");
const Certificate = pkijs.Certificate;
const buf = new Buffer(_idpX509Cert, 'base64').buffer;
console.log('_idpX509Cert', _idpX509Cert);
const asn1 = asn1js.fromBER(buf);
@mikesmullin
mikesmullin / wrap.js
Created July 14, 2018 07:20
sort of looks like a regexp parser; will use regexp instead
var wrap = (list, test, cb) => {
const stack = [];
let start, end, lastTest, result, lastItem, item, out;
for (let i=0,len=list.length; i<len; i++) {
item = list.splice(i,1)[0];
result = test(item, lastItem);
if ((!result && lastTest !== result) || (i === list.length-1 && lastTest === result)) {
out = cb(item, i, start, end, stack, lastItem);
if (null != out) {
list.splice(i, 0, ...out);