Skip to content

Instantly share code, notes, and snippets.

View andrewljohnson's full-sized avatar

Andrew L. Johnson andrewljohnson

View GitHub Profile
from bs4 import BeautifulSoup
import pandas as pd
with open('magiccon.html', 'r', encoding='utf-8') as file:
html_data =
soup = BeautifulSoup(html_data, 'html.parser')
# Initialize lists to store data
data = {
'Title': [],
from segments.huggingface import release2dataset
from segments import SegmentsClient
dataset_identifier = "andrewljohnson/magic_cards"
release_name = "v0.1"
api_key = "HIDDEN"
client = SegmentsClient(api_key) # this is different from blog, blog seemed outdated
release = client.get_release(dataset_identifier, release_name)
hf_dataset = release2dataset(release)
from segments.utils import get_semantic_bitmap
Print out all ways for attackers to be blocked. blockAssignments maps ids of attackers to
vectors of defender ids for which blocks have already been chosen. defenders/defendersIterator specify
defenders that could block any of the attackers. This method iterates over all ways to choose blocks for
the remaining defenders.
example input: groupDefenders({0:[2 3] 1:[4 5]}, [6 7 8 9], 3)
This method prints all possible blocks, recursively.
For example, if you have blockers A & B, and attacker C, there are three posible blocks.
No blockers:
C blocks A:
void groupDefenders(vector<vector<int>> attackers, vector<int> defenders, int i) {
int x = 0;
for (vector<int> attackerBucket:attackers) {
cout << x << ": ";
for (int defender:attackerBucket) {
cout << defender << " ";
cout << "\n";
x+= 1;
#include <iostream>
#include <string>
#include <vector>
using namespace std;
// Current Cards
// Mountain
// Future Cards
#include <iostream>
using namespace std;
// Current Cards
// Mountain
// Future Cards
// Forest
// Lightning Bolt, Giant Growth, Earthquake
import datetime
import math
import numpy as np
import pandas as pd
import pickle
import time
from django.db.models.functions import Cast
from django.db.models import IntegerField
from real_estate.models import AnalysisRecord
root@8e3b54c9c353:/code# python shell < real_estate/scripts/
fetching AnalysisRecords took 0.0015206336975097656
Fetched 47555 records for properties.
2183530944 - Hashing AnalysisRecords took 3.006469964981079
annotating years and months took 3.25303053855896
making value map took 36.68412470817566
Using 47550 properties for analysis.
4202095867 - data_hash
4036931971 - value_map_hash
making model took 0.8455119132995605
root@8e3b54c9c353:/code# python shell < real_estate/scripts/
fetching AnalysisRecords took 0.0015499591827392578
Fetched 15577 records for properties.
annotating years and months took 1.1473767757415771
making value map took 11.682528972625732
Using 15573 properties for analysis.
making model took 0.3301811218261719
Model: "model"
Layer (type) Output Shape Param # Connected to