Skip to content

Instantly share code, notes, and snippets.

View joelnitta's full-sized avatar

Joel Nitta joelnitta

View GitHub Profile
@joelnitta
joelnitta / t1_double_cast.R
Created January 24, 2024 08:59
Look for double-casted spells on T1
library(tidyverse)
library(magicr)
library(arrow)
# Download WOE replay data
woe_game_replay_file <- mr_download_17lands_file(
"WOE", "replay", "premier")
# Load WOE replay data
woe_game_replay <- arrow::open_csv_dataset(
@joelnitta
joelnitta / check_t1_cards_for_draft_id.R
Created January 24, 2024 08:18
Look for double-casted spells on T1 in a particular draft_id
library(tidyverse)
library(magicr)
library(arrow)
# Download WOE replay data
woe_game_replay_file <- mr_download_17lands_file(
"WOE", "replay", "premier")
# Load WOE replay data
woe_game_replay <- arrow::open_csv_dataset(
@joelnitta
joelnitta / check_cards_played_t1.R
Created January 23, 2024 01:50
Check the cards played on turn one of a Limited MtG game
# To install magicr
# pak::pkg_install("joelnitta/magicr")
library(tidyverse)
library(magicr)
# OP:
# I'm working on some WOE replay data for Premier Draft and I'm seeing some
# stuff I don't understand. On row-index 8541, user plays both "Bakery Raid" and
# "Welcome to Sweet Tooth" on turn one, which can't happen. The same happens on
@joelnitta
joelnitta / wr_by_rank.R
Last active January 21, 2024 07:11
Calculate 17lands win-rate by rank across sets
# To install magicr
# pak::pkg_install("joelnitta/magicr")
library(tidyverse)
library(magicr)
library(ggrepel)
# Win-rate by rank and set ----
# Define function to calculate win-rate by rank for a particular set
@joelnitta
joelnitta / archive_twitter_friends.R
Created November 18, 2022 11:34
Archive a user's friends on twitter
library(rtweet)
# Initial authorization setup, only need to do once
# auth_setup_default() #nolint
# Authorize
auth_as("default")
# Set user name
user_name <- "PUT USER NAME HERE"
@joelnitta
joelnitta / archive_tweets.R
Created November 18, 2022 03:03
Archive a user's tweets
library(rtweet)
library(tidyverse)
# Initial authorization setup, only need to do once
# auth_setup_default() #nolint
# Authorize
auth_as("default")
# Set user name
@joelnitta
joelnitta / parse_ncbi_tax_record.R
Last active October 25, 2022 11:22
R code for extracting NCBI taxonomy data
library(tidyverse)
library(assertr)
# Define custom parsing function
#' Parse a single record from the NCBI taxonomy database
#'
#' The NCBI taxonomy database contains names in the `names.dmp` file.
#' A single record (corresponding to one `taxid`) looks like this:
#'
@joelnitta
joelnitta / test.po
Created August 8, 2022 21:46
Test PO file for po4a
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2022-08-08 07:55+0000\n"
@joelnitta
joelnitta / test.md
Created August 8, 2022 21:46
test md file for po4a

This a markdown document

# a comment to be translated
ls
@joelnitta
joelnitta / 1K_SARS-CoV-2_SG-thorney.xml
Created June 28, 2022 05:41
XML file for thorney beast run with relaxed clock
<?xml version="1.0" standalone="yes"?>
<!-- Generated by BEAUTi v1.10.4 -->
<!-- by Alexei J. Drummond, Andrew Rambaut and Marc A. Suchard -->
<!-- Department of Computer Science, University of Auckland and -->
<!-- Institute of Evolutionary Biology, University of Edinburgh -->
<!-- David Geffen School of Medicine, University of California, Los Angeles-->
<!-- http://beast.community/ -->