Skip to content

Instantly share code, notes, and snippets.

@Heath123
Heath123 / download.js
Created October 18, 2023 16:34
Panopto downloader (messy code but it works)
(async () => {
async function fetchDeliveryInfo(deliveryId, tid, invocationId, options) {
if ((!window.location.href.includes("/Pages/")) || (!deliveryId)) {
alert("Not a Panopto page!");
throw new Error("Not a Panopto page!");
}
const url = window.location.href.split("/Pages/")[0] + '/Pages/Viewer/DeliveryInfo.aspx';
const params = new URLSearchParams();
FROM rustlang/rust:nightly
# Install dependencies
RUN apt update
RUN apt install -y texinfo libgmp3-dev libmpc-dev libmpfr-dev bison flex
# Download binutils
WORKDIR /usr/src/
RUN wget https://ftp.gnu.org/gnu/binutils/binutils-2.40.tar.gz
RUN tar -xzf binutils-2.40.tar.gz
@Heath123
Heath123 / tilemap.S
Created December 3, 2022 16:40
Assembly code
.global _draw3DLine
.type _draw3DLine, @function
_draw3DLine: # (r4: x, r5: y, r6: dx, r7: dy) -> r0
# vramLine is stored in a global because I don't want to deal with loading it from the stack
# Save registers
mov.l r8,@-r15
mov.l r9,@-r15
mov.l r10,@-r15
mov.l r11,@-r15
@Heath123
Heath123 / tutorial.md
Last active August 13, 2022 13:19
w2c2 + AssemblyScript tutorial

w2c2 + AssemblyScript tutorial

This tutorial shows you how to make a simple Hello World work with AssemblyScript and w2c2. For this example we will create a simple print function in C and pass it through to AssemblyScript, and try to explain the concepts behind how it works.

Step 1 - Write and compile the AssemblyScript file

Create a file called hello.ts with the following content:

print("Hello, world!")

Now if you try to compile it with asc -o hello.wasm hello.ts, you will get this error:

ERROR TS2304: Cannot find name 'print'.
#include <napi.h>
#include <string>
#include "greeting.h"
// native C++ function that is assigned to `greetHello` property on `exports` object
Napi::String greetHello(const Napi::CallbackInfo& info) {
Napi::Env env = info.Env();
// call `helloUser` function from `greeting.cpp` file
// WARNING: We are passing hardcoded `MIKE` value for now
import gradio as gr
import re
from magma import Magma
from magma.image_input import ImageInput
model = Magma.from_checkpoint(
config_path = "configs/MAGMA_v1.yml",
checkpoint_path = "./mp_rank_00_model_states.pt",
device = 'cuda:0'
)
@Heath123
Heath123 / config.fish
Created February 11, 2022 16:25
Natural language to command
# Add to config.fish
function n
set completedcommand (natural2command $argv)
commandline -i "$completedcommand"
end
@Heath123
Heath123 / rename.py
Created July 20, 2021 16:43
Rename Minecraft rd-132211 OpenGL calls
import re
import math
import os
regex = re.compile("(GL11\.gl.*)\(([0-9]+)\)")
values = {256: ['GL_ACCUM', 'GL_DEPTH_BUFFER_BIT'], 257: ['GL_LOAD'], 258: ['GL_RETURN'], 259: ['GL_MULT'], 260: ['GL_ADD'], 512: ['GL_NEVER', 'GL_ACCUM_BUFFER_BIT'], 513: ['GL_LESS'], 514: ['GL_EQUAL'], 515: ['GL_LEQUAL'], 516: ['GL_GREATER'], 517: ['GL_NOTEQUAL'], 518: ['GL_GEQUAL'], 519: ['GL_ALWAYS'], 1: ['GL_CURRENT_BIT', 'GL_LINES', 'GL_ONE', 'GL_TRUE', 'GL_CLIENT_PIXEL_STORE_BIT'], 2: ['GL_POINT_BIT', 'GL_LINE_LOOP', 'GL_CLIENT_VERTEX_ARRAY_BIT'], 4: ['GL_LINE_BIT', 'GL_TRIANGLES'], 8: ['GL_POLYGON_BIT', 'GL_QUAD_STRIP'], 16: ['GL_POLYGON_STIPPLE_BIT'], 32: ['GL_PIXEL_MODE_BIT'], 64: ['GL_LIGHTING_BIT'], 128: ['GL_FOG_BIT'], 1024: ['GL_STENCIL_BUFFER_BIT', 'GL_FRONT_LEFT'], 2048: ['GL_VIEWPORT_BIT', 'GL_EXP'], 4096: ['GL_TRANSFORM_BIT', 'GL_TEXTURE_WIDTH'], 8192: ['GL_ENABLE_BIT', 'GL_S'], 16384: ['GL_COLOR_BUFFER_BIT', 'GL_LIGHT0'], 32768: ['GL_HINT_BIT'], 65536: ['GL_EVAL_BIT'], 131072: ['GL_LIST_BIT'], 262144: ['GL_TEXT
package com.example;
public class HitData {
public float[] hit_pos;
public float[] hit_norm;
public boolean hit;
public HitData(float[] hit_pos, float[] hit_norm, boolean hit) {
this.hit_pos = hit_pos;
this.hit_norm = hit_norm;
@Heath123
Heath123 / script.js
Created August 3, 2020 20:12
Put it in the Scripts tab of https://github.com/Heath123/pakkit and tick "Enable scripting" BEFORE you join the proxy
// See the node-minecraft-protocol docs
// When editing your scripts, disable scripting or disconnect so
// you don't get lots of errors.
// Handles packets going from the client to the server
exports.upstreamHandler = function (meta, data, server, client) {
const breakTime = 8250 // Break time in ms, try changing this
if (meta.name === 'block_dig') {
if (data.status === 0) {