Skip to content

Instantly share code, notes, and snippets.

@903124
903124 / demographic.csv
Created September 30, 2026 07:03
2020-2024 selected sample of demographic for president and senate polls
We can't make this file beautiful and searchable because it's too large.
poll_label,pollster,org,race,year,office,state,field_dates,last_field_day,days_to_election,n,population,topline_published_D,topline_published_R,poll_margin_R_2party,certified_margin_R_2party,margin_error_pp,dimension,bin_as_published,bin_normalized,poll_bin_vote_D_pct_2party,poll_bin_vote_R_pct_2party,exitpoll_bin_D_pct,exitpoll_bin_R_pct,collection_tag,field_start,exitpoll_source,certified_raw_margin_R_pp,certified_source,exitpoll_group_label,exitpoll_group_numrows,exitpoll_group_share_pct,catalist_group_label,catalist_group_share_pct,cps_group_label,cps_group_share_pct,benchmark_sources_matched
"2020-Governor-NC|Emerson August 8-10, 2020",Emerson College Polling,Emerson,2020-Governor-NC,2020,Governor,NC,"August 8-10, 2020",2020-08-10,85,673,RV,53.2,46.8,-6.4,-4.58,1.82,Age,18-29 years,18-29 years,63.8,36.2,58.3,41.7,midfield_2020_2022,,CNN/Edison 2020-GG-NC,-4.58,Wikipedia: 2020 North Carolina gubernatorial election,18-24 + 25-29,6.0,14.0,ages 18-29 (native bands),15.64,ages 18-29,16.46090268840494,Exit|Cat
import polars as pl
import numpy as np
import json
import fastplotlib as fpl
from fastplotlib.ui import EdgeWindow
from imgui_bundle import imgui
import matplotlib.pyplot as plt
import pyperclip # For clipboard functionality
# Set numpy defaults
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Baseball Seam visualizer</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
margin: 0;
@903124
903124 / UMBA_statcast.py
Last active September 7, 2025 15:29
Updating https://github.com/AndRoo88/Baseball-Flight-Calculator to use real Statcast data as input
# Updating https://github.com/AndRoo88/Baseball-Flight-Calculator to use real Statcast data as input
# Modify processing.py to change scipy deprecated rotation
# Here one pitch is randomly selected from each pitch typea and calculate its trajectory using different seam orientation
#from scipy.spatial.transform import Rotation as R
def _create_rotation_from_matrix(matrix):
# """
# Create a scipy Rotation object from a rotation matrix.
# Handles compatibility between old (from_dcm) and new (from_matrix) scipy versions.
# """
import os
from typing import Dict, List
import numpy as np
import pandas as pd
DRS_DIR = os.path.join("Statcast_data", "DRS")
#Adapt from github.com/HKUNLP/Dream and github.com/ML-GSAI/LLaDA
import torch
import numpy as np
import gradio as gr
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModel
import time
import re
import traceback
@903124
903124 / s1.py
Created February 6, 2025 16:58
# outlines/processor/structured.py
...
class GuideLogitsProcessor(OutlinesLogitsProcessor):
"""Bias generation using a finite
Attributes
----------
tokenizer
The tokenizer used to convert tokens to ids.
guide
import chess
import re
import outlines.text.generate as generate
import outlines.models as models
import chess.engine
import chessboard.display
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.