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 / 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) {
@MCJack123
MCJack123 / README.md
Created January 28, 2018 22:17
Allows creating Chrome/Chromium OS apps that run a crouton program

Requirements

How to use

  1. Inside your chroot, compile both C++ sources using jsoncpp.
@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 / 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 / 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 / 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 / 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 / macOSDiscCreator.sh
Last active July 2, 2018 19:43
Automatically generates macOS High Sierra (and higher?) DVD images
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: macOSDiscCreator <path to Install macOS.app>";
exit 1;
fi;
echo "Your password is needed to create the macOS Installer image.";
sudo -v;
echo "Creating temporary macOS Installer image...";
hdiutil create -layout GPTSPUD -fs HFS+ -volname Install\ macOS -attach -type UDIF -size 8g /tmp/InstallmacOS.dmg;
sudo "$1/Contents/Resources/createinstallmedia" --nointeraction --volume /Volumes/Install\ macOS/;
@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 / gitinafile
Last active February 5, 2019 04:43
Quick-and-dirty git repository packer/unpacker
#!/bin/bash
if [ "$1" == "pack" ]; then
BNAME=`basename $2`
mkdir "._$BNAME"
git format-patch --root -o "._$BNAME"
git log > "._$BNAME/history.txt"
tar -cJf "$2" -C "._$BNAME" .
rm -r "._$BNAME"
elif [ "$1" == "unpack" ]; then
BNAME=`basename $2`