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 / generate-world.bash
Created June 28, 2020 00:29
A bash script using xdotool to pregenerate a Minecraft Bedrock world using Linux.
# I use this script to generate a Minecraft world.
# I run a BDS instance with sim distance 12 and a
# instance of the unofficial Linux client.
# Using a server-client setup seems to be more stable
# than running client only.
#
# Make sure your player is in creative and flying before
# you begin.
# Script parameters
@reedacartwright
reedacartwright / blocklist.R
Created June 7, 2020 04:18
Minecraft Bedrock: Extract block information for the region 0,16,0 to 63,79,63 in a world file.
# update if neccessary
devtools::install_github("reedacartwright/rbedrock")
library(jsonlite)
library(tidyverse)
library(rbedrock)
db <- bedrockdb(dbpath_goes_here)
# read blocks in cube from 0,16,0 to 63,79,63
@reedacartwright
reedacartwright / wither_killer.R
Last active November 27, 2021 14:43
Minecraft Bedrock: Find a location in the overworld that can work as a natural wither killer.
# Copyright (c) 2020 Reed A. Cartwright
#
# 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
# notice, this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright
@reedacartwright
reedacartwright / plot_chunks.R
Created May 23, 2020 02:19
Plotting Overworld Chunks
library(tidyverse)
library(rbedrock)
# generate a list of worlds
list_worlds()
# use the most recent file, adjust as needed
dbpath <- list_worlds()$folder[1]
# open the world db
@reedacartwright
reedacartwright / reset_nether.md
Last active January 28, 2023 03:44
Using mcberepair to Reset the Nether

This tutorial is for Minecraft Bedrock Edition worlds that have been imported to a Windows 10 copy of the game. It will work with XBox, Android, PS4, etc. worlds, but they must be first copied to a Windows installation.

Download the following two files.

Place busybox64.exe in your minecraftWorlds directory. This is located at %LOCALAPPDATA%\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\minecraftWorlds.

@reedacartwright
reedacartwright / find_spawners.R
Created March 14, 2020 00:26
A script for identifying all spawners in a Minecraft World
# uncomment and reinstall rbedrock to get the latest code.
# devtools::install_github("reedacartwright/rbedrock", INSTALL_opts="--no-multiarch")
library(tidyverse)
library(rbedrock)
# Local copy of the Advanced Automation Realm
# replace with your own world id
dbpath <- "XBdsXqo+AAA="
@reedacartwright
reedacartwright / aatodna.R
Created March 31, 2019 01:52
Align DNA sequences using an amino acid alignment
#!/usr/bin/Rscript --vanilla
suppressPackageStartupMessages(library(stringr))
suppressPackageStartupMessages(library(Biostrings))
G = BString("-")
main = function(infile, dnafile, outfile) {
ARGS = commandArgs(trailingOnly=TRUE)
if(missing(infile)) {
@reedacartwright
reedacartwright / dynamic_machine.cc
Last active February 28, 2018 00:09
Example of using virtual functions to dynamically construct a functor machine
// Compile with -std=c++14
#include <array>
#include <memory>
#include <iostream>
#include <algorithm>
struct A {
virtual void operator()() = 0;
std::array<int,10> data;
@reedacartwright
reedacartwright / mutaton_entropy.R
Created December 14, 2017 23:37
Script to calculate the entropy of a mutation specturm from a vcf
# This script calculates the average entropy and effective number of
# possible mutants for the human mutation spectrum.
# Preparing to run this script
# > wget ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b150_GRCh38p7/VCF/common_all_20170710.vcf.gz
# > wget ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606_b150_GRCh38p7/VCF/common_all_20170710.vcf.gz.tbi
# > bcftools query -f '%REF\t%ALT\n' common_all_20170710.vcf.gz | zstd > altref.txt.zst
library(data.table)
library(stringr)
@reedacartwright
reedacartwright / coveragehmm.R
Last active December 13, 2017 22:15
HMM to estimate coverage
#!/usr/bin/Rscript
# Authors: David Winter
# Joanna Malukiewicz
# Reed A. Cartwright
library(HiddenMarkov)
library(data.table) #makes reading a data table faster than using R data frame functions
library(jsonlite)
cat("Started at ", as.character(Sys.time()), "\n")