Skip to content

Instantly share code, notes, and snippets.

View reedacartwright's full-sized avatar
💭
I may be slow to respond.

Reed A. Cartwright reedacartwright

💭
I may be slow to respond.
View GitHub Profile
@reedacartwright
reedacartwright / mult.c
Created November 23, 2023 03:29
Full width multiplication of two 32-bit numbers.
/*
This file contains examples of how to do full-width 32-bit multiplication by dividing each
operand into 16-bit fields.
*/
typedef struct {
int low;
int high;
} int_pair_t;
@reedacartwright
reedacartwright / lesson.md
Last active April 28, 2024 22:06
NHANES Analysis

Introduction

Today we will be working with data from the National Health and Nutrition Examination Survey (NHANES).

NHANES is a program of studies designed to assess the health and nutritional status of adults and children in the United States. The survey is unique in that it combines interviews and physical examinations. NHANES is a major program of the National Center for Health Statistics (NCHS). NCHS is part of

@reedacartwright
reedacartwright / brca1-project.md
Created April 26, 2022 01:11
Instructions for analyzing BRCA1 mutations

In this exercise we are going to download human genomic data generated by the New York Genome Center (NYGC). Information about the data can be found here and details about their pipeline can be found here.

Initializing Project

We will start by setting up a git repository on the cluster to hold our project data.

$ mkdir brca1-project
$ cd brca1-project
$ git init
@reedacartwright
reedacartwright / ga-pipeline-1.md
Last active March 31, 2022 01:07
Instructions for creating a genomic analysis pipleine using Github and a reproducable directory structure

After creating your repository on Github, you need to clone it to Agave. Don't forget to use the correct github url for your repository.

$ cd ~/dc_workshop
$ git clone git@github.com:USERNAME/ga-pipeline-1.git ga-pipeline-1
$ cd ga-pipeline-1

Getting Raw Data

@reedacartwright
reedacartwright / am_class7.R
Last active January 7, 2022 02:57
Plotting Biome using RBedrock
## Today we will work on making maps with ggplot2.
# Install the latest version of rbedrock
devtools::install_github("reedacartwright/rbedrock")
# Load tidyverse and rbedrock
library(tidyverse)
library(rbedrock)
# Open World Database
@reedacartwright
reedacartwright / am_class4.R
Created November 7, 2021 04:06
Introduction to Analyzing a Minecraft World, LIA 194 - Class 4
## Today we are going to work on learning how to plot data with
## ggplot2, which is a part of tidyverse.
# Install the latest version of rbedrock
devtools::install_github("reedacartwright/rbedrock")
# Install tidyverse
install.packages("tidyverse")
# Load tidyverse and rbedrock
@reedacartwright
reedacartwright / am_class2.R
Last active October 26, 2021 02:55
Introduction to Analyzing a Minecraft World, LIA 194 - Class 2
# Introduction to Analyzing a Minecraft World
# LIA 194 - Class #2
# We will be using the development branch of the rbedrock library,
# and will use devtools to install or update it.
if (!requireNamespace("devtools", quietly = TRUE)) {
install.packages("devtools")
}
devtools::install_github("reedacartwright/rbedrock")
@reedacartwright
reedacartwright / find_wither_killer.cc
Created June 10, 2021 21:22
Source code for finding natural wither killers in bedrock edition.
#include <random>
#include <array>
#include <iostream>
using namespace std;
using mat_t = array<array<unsigned int, 32>, 32>;
uint32_t get_seed(int d, int x, int z) {
if(d == 0) {
@reedacartwright
reedacartwright / falling_time.csv
Created March 15, 2021 06:33
How long it takes for a mob to fall in Minecraft.
y ticks seconds
0 0 0
1 5 0.25
2 7 0.35
3 9 0.45
4 10 0.5
5 12 0.6
6 13 0.65
7 14 0.7
8 15 0.75
@reedacartwright
reedacartwright / blockstate_protocol.md
Created February 26, 2021 02:02 — forked from Tomcc/blockstate_protocol.md
Block Changes in Beta 1.2.13

Block Storage & Network Protocol Changes

Paletted chunks & removing BlockIDs brings a few big changes to how blocks are represented. In Bedrock, Blocks used to be represented by their 8 bit ID and 4 bit data; this means that we can only represent 256 blocks and 16 variants for each block. As it happens we ran out of IDs in Update Aquatic, so we had to do something about it :)

After this change, we can represent infinite types of Blocks and infinite BlockStates, just like in Java. BlockStates are what is sent over the network as they are roughly equivalent to the old ID+data information, eg. they're all the information attached to a block.

BlockStates are serialized in two ways:

PersistentID: a PersistentID is a NBT tag containing the BlockState name and its variant number; for example