Skip to content

Instantly share code, notes, and snippets.

View garrettjoecox's full-sized avatar

Garrett Cox garrettjoecox

View GitHub Profile
@garrettjoecox
garrettjoecox / readlines.ts
Created December 18, 2023 00:50
readLines usage
import { readLines } from "https://deno.land/std@0.208.0/io/read_lines.ts";
(async function processStdin() {
try {
for await (const line of readLines(Deno.stdin)) {
const [command, ...args] = line.split(" ");
switch (command) {
default:
case "help": {
@garrettjoecox
garrettjoecox / decompRename.js
Created September 15, 2023 17:35
z64Item renames
const fs = require('fs');
const path = require('path');
const C_FILES_REGEX = /.+(\.cpp|\.c|\.inc|\.h)$/;
const z64itemMap = {
// EquipmentType
'EQUIP_SWORD': 'EQUIP_TYPE_SWORD',
'EQUIP_SHIELD': 'EQUIP_TYPE_SHIELD',
'EQUIP_TUNIC': 'EQUIP_TYPE_TUNIC',
@garrettjoecox
garrettjoecox / rename.js
Last active September 5, 2023 13:17
Some documentation changes for zplayer
const fs = require('fs');
const path = require('path');
const C_FILES_REGEX = /.+(\.cpp|\.c|\.inc|\.h)$/;
const variablesMap = {
'D_80125DE8': 'gPlayerLeftHandBgsDLs',
'D_80125E08': 'gPlayerLeftHandOpenDLs',
'D_80125E18': 'gPlayerLeftHandClosedDLs',
'D_80125EF8': 'gPlayerLeftHandBoomerangDLs',
// This is an inventory architecture using Bevy's ECS
// An inventory is a collection of inventory slots, which can hold an item.
// An inventory can be any shape or size (think a chest vs a player's inventory vs a crafting table)
// An inventory slot can be empty, or hold an item stack.
// Some inventory slots can only hold certain types of item stacks (think armor slots)
// An item stack is a collection of items of the same type, some items can be stacked, some can't.
// An item stack can be split into two item stacks, or merged with another item stack.
// Each type of item has different properties like consumable, stackable, etc.
@garrettjoecox
garrettjoecox / index.js
Last active June 17, 2023 14:10
Replaces manual flag get/sets and hardcoded numbers with a uniform functionCall(MACRO)
const fs = require('fs');
const path = require('path');
// Example 1
// Before: gSaveContext.eventChkInf[4] |= 0x8
// After: Flags_SetEventChkInf(EVENTCHKINF_43)
// Example 2
// Before: Flags_GetInfTable(4)
// After: Flags_GetInfTable(INFTABLE_04)
@garrettjoecox
garrettjoecox / .mod.ts
Last active November 12, 2021 22:42
Bible to CSV
const apiKey = '';
const baseUrl = 'https://api.scripture.api.bible/v1';
(async () => {
try {
const [translation] = await fetchJson('/bibles?language=ENG&ids=de4e12af7f28f599-01');
const books = await fetchJson(`/bibles/${translation.id}/books?include-chapters=true`);
let csv = 'TRANSLATION,BOOK,CHAPTER,VERSE,REFERENCE,CONTENT\n';
await books.reduce(async (prevBook: any, book: any) => {
await prevBook;
@garrettjoecox
garrettjoecox / MacOS Startup Killer.md
Created September 23, 2021 15:04
Actually remove all startup items on MacOS
  • Remove all login items at System Preferences > Users & Groups > Login Items
  • Remove local startup items with the following:
sudo rm -rf ~/Library/LaunchAgents/*
sudo rm -rf ~/Library/LaunchDaemons/*
sudo rm -rf ~/Library/StartupItems/*
  • Remove global startup items with the following:
sudo rm -rf /Library/LaunchAgents/*
@garrettjoecox
garrettjoecox / instructions.md
Last active October 1, 2023 21:49
Make windows 10 suck less

Windows 10 not suck mode

This guide is currently updated for Windows 10 2021 LTSC (21H2)

Installation

  • Create a bootable USB thumb drive (Windows 10 X64 Enterprise LTSC 2021 ESD MULTi-6 JAN 2022 {Gen2} on pirate bay)
  • Boot computer onto drive
  • Press Install Now
  • Choose "Custom: Install Windows only"
try {
if(window._xProducts) {
window._xProducts.print_barcodes = function (skus, type = 'barcode') {
var _this = this;
var title = 'How many barcodes do you want to print?';
var names = {};
_xDatatables.api.data().toArray().forEach(function (item) {
names[item.sku] = item.name;
});
### Keybase proof
I hereby claim:
* I am garrettjoecox on github.
* I am garrettjcox (https://keybase.io/garrettjcox) on keybase.
* I have a public key ASAtUIUhLhJixJpfrO-oaSXrJOX_ZYvQGVPJRkQ7kDOPQAo
To claim this, I am signing this object: