Skip to content

Instantly share code, notes, and snippets.

@jenyeeiam
jenyeeiam / uniqueSum.js
Created April 1, 2024 16:23
cassido 2024-04-01 submission
function uniqueSum(arr) {
if(!arr || arr.length === 0){
return 0
}
const stringArr = arr.map(function(num) {
return num.toString();
})
let runningSum = 0;
# -*- coding: utf-8 -*-
"""matchy_matchy.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1CCjJxeSXELh08NWzuKw4WDX8Aun8gMiy
"""
from google.colab import files
@jenyeeiam
jenyeeiam / import_model_make_predictions.py
Last active March 12, 2024 21:12
Train and predict qual scores
import torch
import pandas as pd
from multi_label_class import MultiTaskBertModel # Import the model class
from transformers import AutoTokenizer
def load_model(model_path, device):
model = MultiTaskBertModel.from_pretrained("bert-base-cased")
model.load_state_dict(torch.load(model_path, map_location=device))
model.to(device)
@jenyeeiam
jenyeeiam / csv_to_json.py
Last active February 22, 2024 17:05
Converts qual score data from csv to json for training
import csv
import json
# Define the input and output file names
input_csv_file = 'connection_data.csv'
output_json_file = 'connection_data.json'
# Function to preprocess text according to the specified rules
def preprocess_text(text):
# Replace internal double quotes with two double quotes
function ArrayQueue(capacity) {
this.capacity = capacity;
this.start = 0;
this.end = 0;
this.length = 0;
this.a = new Array(capacity);
this.add = function(num) {
if(this.length == this.a.length) {
console.log('MAX CAPACITY');
@jenyeeiam
jenyeeiam / xml_testing.py
Created March 18, 2021 22:21
Make character detail
from xml.etree import ElementTree
from xml import etree
#in order to test it you have to create testing.xml file in the folder with the script
xmlParsedWithET = ElementTree.parse("testing.xml")
root = xmlParsedWithET.getroot()
def CDATA(text=None):
element = ElementTree.Element('![CDATA[')
element.text = text
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import matplotlib.patches as mpatches # needed for waffle Charts
from wordcloud import WordCloud, STOPWORDS
from PIL import Image
import seaborn as sns
import pdb
import sys
@jenyeeiam
jenyeeiam / Gemfile
Created May 16, 2020 22:12
Downloads softball pdfs from NCAA
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem 'kimurai'
gem 'nokogiri'
gem 'mechanize'
@jenyeeiam
jenyeeiam / defense_wins_champs.py
Created May 6, 2020 04:38
code for making plots for defense wins championship blog post
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import matplotlib.patches as mpatches # needed for waffle Charts
from wordcloud import WordCloud, STOPWORDS
from PIL import Image
import seaborn as sns
import pdb
from stats_reader import NCAA_DATA_FRAME as df
@jenyeeiam
jenyeeiam / scraper.rb
Created April 26, 2020 17:02
Scraper to all the division one softball stats for 1 year
require 'httparty'
require 'mechanize'
require 'Nokogiri'
require 'csv'
require 'pry'
inputs = ARGV
if !inputs then
raise "Input a year from 2018 to 2002"
end