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 / buffer.c
Created October 22, 2018 15:52
FILE-like buffer system for memory
//
// buffer.c
//
// Created by Homework User on 10/20/18.
// Copyright ยฉ 2018 JackMacWindows. All rights reserved.
//
#include "buffer.h"
#include <stdlib.h>
#include <string.h>
@MCJack123
MCJack123 / chunkcheck.c
Last active December 7, 2024 11:02
A tool to read/write BSD/macOS chunklist files, such as BaseSystem.dmg.chunklist. (Signing is not supported yet.)
/* Requires C99 or C++14 or later */
/* Chunklist file format */
#include <stdint.h>
#define CHUNKLIST_MAGIC 0x4C4B4E43
#define CHUNKLIST_FILE_VERSION_10 1
#define CHUNKLIST_CHUNK_METHOD_10 1
#define CHUNKLIST_SIGNATURE_METHOD_10 1
#define CHUNKLIST_SIG_LEN 256
#define CHUNKLIST_PUBKEY_LEN (2048/8)
#define SHA256_DIGEST_LENGTH 32
@MCJack123
MCJack123 / 8ci-png.cpp
Last active November 12, 2022 04:13
Converts TI-84+ CE .8ci bitmap pictures/images to PNG files
// requires libpng and png++ (brew install png++) (sudo apt-get install libpng++-dev)
// compile with g++ -o 8ci-png 8ci-png.cpp -lpng
// add -I/usr/local/include if on mac and errors out with "png++/png.hpp: no such file or directory"
#include <iostream>
#include <fstream>
#include <vector>
#include <png++/png.hpp>
//-----------8ci palette---------------
std::vector<png::rgb_pixel> colors = {
@MCJack123
MCJack123 / Polulu44780.cpp
Created May 14, 2018 02:48
Two-line menu system supporting HD44780 LCDs with ncurses simulation
// Copyright Pololu Corporation. For more information, see http://www.pololu.com/
#ifdef __arm__
#include "PololuHD44780.h"
#define LCD_CLEAR 0x01
#define LCD_SHOW_BLINK 0x0F
#define LCD_SHOW_SOLID 0x0E
#define LCD_HIDE 0x0C
#define LCD_CURSOR_L 0x10
#define LCD_CURSOR_R 0x14
@MCJack123
MCJack123 / hexedit.cpp
Last active May 6, 2018 23:44
A simple ncurses-based hex editor supporting files up to 4GB
// compile with: g++ -o hexedit -std=c++11 hexedit.cpp -lncurses
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <utility>
#include <iomanip>
#include <stdint.h>
#include <math.h>
#include <ncurses.h>
@MCJack123
MCJack123 / mathsound.cpp
Created April 5, 2018 03:28
Equation to WAV converter (requires exprtk)
#include <iostream>
#include <fstream>
#include <string>
#include <cstdint>
#include "exprtk.hpp"
typedef struct {
char sGroupID[4];
uint32_t dwFileLength;
char sRiffType[4];
@MCJack123
MCJack123 / 8S1A-Node.js
Created February 5, 2018 21:06
*Simulator* for upcoming Minecraft 8-bit CPU
function C8S1A(outHandler) {
var c = {};
c.out = outHandler;
c.cache = new Array(256);
c.exec = function(f, argv) {
if (typeof this[f] != "function") {this.out("Invalid instruction " + typeof this[f]); return;}
var nv = new Array();
var iter = 0;
var skip = -1;
//console.log(argv);
@MCJack123
MCJack123 / README.md
Last active January 28, 2018 22:27
Allows creating Chrome/Chromium OS apps that run a crouton program

Requirements

  • Developer Mode enabled (of course)
  • ruby & crxmake
  • jsoncpp
  • nodejs & node-dweetio
  • crouton with xiwi
  • crouton extension

How to use

  1. Inside your chroot, compile both C++ sources using jsoncpp.
@MCJack123
MCJack123 / README.md
Created January 28, 2018 22:17
Allows creating Chrome/Chromium OS apps that run a crouton program
@MCJack123
MCJack123 / pngblur.cpp
Last active December 25, 2017 03:15
PNG box blur algorithm (requires libpng & png++)
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <png++/png.hpp>
typedef std::vector<std::pair<size_t, size_t> > points_t;
bool verbose = false;
points_t get_points(size_t x, size_t y, png::uint_32 w, png::uint_32 h, int s) {