Skip to content

Instantly share code, notes, and snippets.

View MCJack123's full-sized avatar
๐Ÿ’š
Go Green!

JackMacWindows MCJack123

๐Ÿ’š
Go Green!
View GitHub Profile
@MCJack123
MCJack123 / ScoreSaberGetMap.user.js
Last active January 15, 2022 02:37
Small UserScript to add download links to ScoreSaber leaderboard pages (requires GreaseMonkey/TamperMonkey/*Monkey)
// ==UserScript==
// @name ScoreSaberGetMap
// @version 4
// @grant none
// @match *://scoresaber.com/leaderboard/*
// ==/UserScript==
let attempts = 0;
function doit() {
let box = document.querySelector("div.content.svelte-n29l0e > strong.text-muted.svelte-n29l0e");
@MCJack123
MCJack123 / ccbot.js
Last active February 28, 2024 08:39
Discord bot that executes Lua code in CraftOS-PC, and returns a screenshot of the result
// Requires https://gist.github.com/MCJack123/4eb02b57de9fcb9c6e62b9b459ada8e6
// Extract env-clean.tar into env-clean next to this file
const { Client, MessageAttachment } = require('discord.js');
const exec = require('child_process').exec;
const fs = require("fs-extra");
const http = require("https");
const client = new Client();
const init_script = (script, author) => `
term.clear()
term.setCursorPos(1, 1)
@MCJack123
MCJack123 / dbprotect.lua
Last active June 4, 2024 18:06
dbprotect.lua - Protect your functions from the debug library
-- dbprotect.lua - Protect your functions from the debug library
-- By JackMacWindows
-- Licensed under CC0, though I'd appreciate it if this notice was left in place.
-- Simply run this file in some fashion, then call `debug.protect` to protect a function.
-- It takes the function as the first argument, as well as a list of functions
-- that are still allowed to access the function's properties.
-- Once protected, access to the function's environment, locals, and upvalues is
-- blocked from all Lua functions. A function *can not* be unprotected without
-- restarting the Lua state.
@MCJack123
MCJack123 / rawpngrender.cpp
Created April 19, 2021 21:36
Render CraftOS-PC raw terminal packets to PNG (requires png++)
// Compile together with https://github.com/MCJack123/craftos2/blob/master/src/font.c
#include <iostream>
#include <sstream>
#include <algorithm>
#include <array>
#include <numeric>
#include <png++/png.hpp>
extern "C" {
struct font_image {
@MCJack123
MCJack123 / qr.lua
Created March 14, 2021 05:57
Modified version of https://github.com/speedata/luaqrcode/blob/master/qrcode.lua for ComputerCraft, with a drawing function
--- The qrcode library is licensed under the 3-clause BSD license (aka "new BSD")
--- To get in contact with the author, mail to <[email protected]>.
---
--- Please report bugs on the [github project page](http://speedata.github.com/luaqrcode/).
-- Copyright (c) 2012-2020, Patrick Gundlach and contributors, see https://github.com/speedata/luaqrcode
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
@MCJack123
MCJack123 / vericode.lua
Last active September 28, 2024 12:44
VeriCode - Easy code signing for ComputerCraft
--- VeriCode - Easy code signing for ComputerCraft
-- By JackMacWindows
--
-- @module vericode
--
-- Code signing uses encryption and hashes to easily verify a) that the sender of
-- the code is trusted, and b) that the code hasn't been changed mid-transfer.
-- VeriCode applies this concept to Lua code sent over Rednet to add a layer of
-- security to Rednet. Just plainly receiving code from whoever sends it is
-- dangerous, and invites the possibility of getting malware (in fact, I've made
@MCJack123
MCJack123 / loopmodule.cpp
Created February 20, 2021 08:43
Renders module files to WAV/FLAC/OGG/MP3/M4A with looping and fade out (requires libopenmpt; https://github.com/Raveler/ffmpeg-cpp for non-WAV conversion)
// Compiling: cl /EHsc /MD /D_WIN32 /DFFMPEG_CPP /Feloopmodule.exe loopmodule.cpp /link libopenmpt.lib ffmpeg-cpp.lib /LTCG
// If not using ffmpeg-cpp: cl /EHsc /D_WIN32 /Feloopmodule.exe loopmodule.cpp /link libopenmpt.lib
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <sys/stat.h>
@MCJack123
MCJack123 / GDStructures.md
Last active January 26, 2023 08:35
Some reverse-engineering for Geometry Dash's memory structures - WIP

What is this?

This document attempts to document the structures of data that Geometry Dash uses to store information about the game. This is primarily intended for mod developers/hackers who want to read the executable's memory.

If you have any additional information about pointer locations or meanings, feel free to post it in the comments below.

The following data is from version 2.11, 32-bit Windows on Steam. This information will likely differ depending on the version, architecture, and platform.

Game Status - [[[GeometryDash.exe + 3222D0] + 164] + 224] + 600

This structure appears to be mirrored four bytes ahead at [[[GeometryDash.exe + 3222D0] + 164] + 228] + 600, for the second player in two-player/split mode.

@MCJack123
MCJack123 / redrun.lua
Last active September 28, 2024 12:43
RedRun - A very tiny background task runner for CC using the native top-level coroutine
--- RedRun - A very tiny background task runner using the native top-level coroutine
-- By JackMacWindows
-- Licensed under CC0, though I'd appreciate it if this notice was left in place.
-- @module redrun
-- Note: RedRun is not intended for use as a fully-featured multitasking environment. It is meant
-- to allow running small asynchronous tasks that just listen for events and respond (like
-- rednet.run does). While it is certainly possible to use this to make a functioning kernel, you
-- should not do this as a) any time spent in the processes is time taken from Rednet, and b) there
-- is no filtering for user-initiated events, or automatic terminal redirect handling.
@MCJack123
MCJack123 / sound.cpp
Last active March 20, 2021 06:53
Please go to https://github.com/MCJack123/craftos2-plugins for new versions of this plugin.
/*
* sound.cpp plugin for CraftOS-PC
* Adds a number of programmable sound channels (default 4) that play sound waves with the specified frequency, wave type, volume, and pan position.
* Windows: cl /EHsc /Fesound.dll /LD /Icraftos2\api /Icraftos2\craftos2-lua\include plugin.cpp /link craftos2\craftos2-lua\src\lua51.lib SDL2.lib SDL2_mixer.lib
* Linux: g++ -fPIC -shared -Icraftos2/api -Icraftos2/craftos2-lua/include -o sound.so sound.cpp craftos2/craftos2-lua/src/liblua.a -lSDL2 -lSDL2_mixer
* Licensed under the MIT license.
*
* MIT License
*
* Copyright (c) 2021 JackMacWindows