Skip to content

Instantly share code, notes, and snippets.

View ZephyrBlu's full-sized avatar
🎯
Focusing

Luke Holroyd ZephyrBlu

🎯
Focusing
  • Shopify
  • London
  • 13:18 (UTC +01:00)
View GitHub Profile
@ZephyrBlu
ZephyrBlu / decoder.rs
Created November 19, 2022 12:18
Rust SC2 Parser
use crate::protocol::Int;
use crate::protocol::ProtocolTypeInfo;
use crate::protocol::Struct;
use std::cmp::min;
use std::collections::HashMap;
use std::str;
use serde::Serialize;
@ZephyrBlu
ZephyrBlu / exportStatic.js
Created March 26, 2021 04:01
My script for deploying an actually static Next.js site
(async () => {
const fs = require('fs').promises;
const { execSync } = require('child_process');
const CSS_PATH = '_next/static/css';
const OUTPUT_DIR = 'deploy';
const BUCKET = 'qnt.gg';
const generatedFiles = await fs.readdir('out');
const staticHtmlFiles = generatedFiles.filter((name) => (
name.slice(-5) === '.html' && name !== '404.html'
@ZephyrBlu
ZephyrBlu / list.md
Created March 17, 2021 10:29 — forked from ih2502mk/list.md
Quantopian Lectures Saved
@ZephyrBlu
ZephyrBlu / TimelineArea.jsx
Created February 25, 2021 13:27
Real component demonstrating the LoadingState component
import React, { useContext, useState, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { useFetch } from '../../hooks';
import UrlContext from '../../index';
import ReplaySummary from './ReplaySummary';
import ReplayTimeline from './ReplayTimeline';
import LoadingState from '../shared/LoadingState';
const TimelineArea = ({ replay }) => {
const urlPrefix = useContext(UrlContext);
@ZephyrBlu
ZephyrBlu / useLoadingState.jsx
Created February 25, 2021 12:49
Custom hook that can be used in conjunction with the LoadingState component to declaratively manage render state
import { useState } from 'react';
const useLoadingState = () => {
const [loadingState, _setLoadingState] = useState(null);
const allowedStates = [
'inProgress',
'success',
'error',
'notFound',
];
@ZephyrBlu
ZephyrBlu / LoadingState.jsx
Last active February 25, 2021 14:04
Wrapper component for managing the render state of components, especially when fetching data
import React, { useRef } from 'react';
import DefaultResponse from './DefaultResponse';
import LoadingAnimation from './LoadingAnimation';
const LoadingState = ({
defer,
noLoad,
spinner,
state,
initial,
from pathlib import Path
from zephyrus_sc2_parser import parse_replay
# change this to match the directory you're using
replays = Path('replays')
# change these to desired cutoff times
BUILDING_SECONDS_INTO_GAME = 0
UPGRADE_SECONDS_INTO_GAME = 0
from pathlib import Path
from multiprocessing import Pool
from sc2_tournament_analysis import recursive_parse
from zephyrus_sc2_parser import parse_replay
def handle_replay(path, player_names, identifiers):
replay = parse_replay(path)
# do stuff and then return the data you want
@ZephyrBlu
ZephyrBlu / analyze_your_replays.py
Created January 13, 2021 02:48
Simple script for analyzing your replays
from pathlib import Path
from zephyrus_sc2_parser import parse_replay
# change this to match the directory you're using
replays = Path('replays')
def recurse(dir_path):
"""
Recursively searches directories to parse replay files
@ZephyrBlu
ZephyrBlu / tournament_analysis.py
Last active March 18, 2020 19:19
Script for SC2 Tournament Analysis
import uuid
import json
from pathlib import Path, PurePath
from sc2_tournament_analysis import recursive_parse, json_to_csv
from multiprocessing import Pool
from fuzzywuzzy import fuzz
from zephyrus_sc2_parser import parse_replay
from sc2_tournament_analysis.defaults import (
standard_ignore_units, standard_merge_units, standard_player_match
)