Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fangeugene
fangeugene / upload_zebra_motionworks.py
Last active January 13, 2020 19:08
Convert old Zebra MotionWorks data and upload to TBA using the Trusted API
import csv
import glob
import hashlib
import json
import numpy as np
import requests
EVENT_KEY = '2019cc'
AUTH_ID = 'ID'
[
{
"actual_time": 1489586400,
"alliances": {
"blue": {
"dq_team_keys": [],
"score": 37,
"surrogate_team_keys": [
"frc103"
],
@fangeugene
fangeugene / 2018cmpmi_pits.json
Created April 24, 2018 23:37
2018cmpmi Pit Locations
{"locations": {"frc20": {"loc": "G54", "div": "Curie"}, "frc25": {"loc": "E19", "div": "Carson"}, "frc27": {"loc": "E33", "div": "Daly"}, "frc33": {"loc": "G32", "div": "Daly"}, "frc45": {"loc": "B57", "div": "Curie"}, "frc51": {"loc": "A42", "div": "Darwin"}, "frc56": {"loc": "B44", "div": "Darwin"}, "frc58": {"loc": "F21", "div": "Archimedes"}, "frc67": {"loc": "A28", "div": "Archimedes"}, "frc70": {"loc": "E58", "div": "Curie"}, "frc71": {"loc": "A12", "div": "Carson"}, "frc74": {"loc": "G34", "div": "Daly"}, "frc78": {"loc": "D42", "div": "Darwin"}, "frc85": {"loc": "A08", "div": "Tesla"}, "frc88": {"loc": "D11", "div": "Carson"}, "frc103": {"loc": "H19", "div": "Carson"}, "frc111": {"loc": "C48", "div": "Darwin"}, "frc125": {"loc": "B45", "div": "Darwin"}, "frc126": {"loc": "F53", "div": "Curie"}, "frc133": {"loc": "D18", "div": "Carson"}, "frc141": {"loc": "B38", "div": "Daly"}, "frc145": {"loc": "B33", "div": "Daly"}, "frc157": {"loc": "F41", "div": "Darwin"}, "frc167": {"loc": "E52", "div": "Curie"},
@fangeugene
fangeugene / 2018cmptx_pits.json
Created April 15, 2018 02:43
2018cmptx Pit Locations
{"locations": {"frc16": {"loc": "A33", "div": "Carver"}, "frc59": {"loc": "I41", "div": "Hopper"}, "frc100": {"loc": "B34", "div": "Carver"}, "frc108": {"loc": "C29", "div": "Carver"}, "frc118": {"loc": "B04", "div": "Newton"}, "frc120": {"loc": "G16", "div": "Turing"}, "frc148": {"loc": "H40", "div": "Hopper"}, "frc175": {"loc": "D37", "div": "Carver"}, "frc179": {"loc": "E01", "div": "Roebling"}, "frc180": {"loc": "H34", "div": "Hopper"}, "frc254": {"loc": "H33", "div": "Hopper"}, "frc294": {"loc": "H37", "div": "Hopper"}, "frc330": {"loc": "E37", "div": "Galileo"}, "frc341": {"loc": "C32", "div": "Carver"}, "frc342": {"loc": "A32", "div": "Carver"}, "frc343": {"loc": "C36", "div": "Carver"}, "frc359": {"loc": "H38", "div": "Hopper"}, "frc360": {"loc": "H02", "div": "Turing"}, "frc364": {"loc": "G09", "div": "Turing"}, "frc368": {"loc": "E38", "div": "Galileo"}, "frc399": {"loc": "G34", "div": "Hopper"}, "frc418": {"loc": "A37", "div": "Carver"}, "frc456": {"loc": "H25", "div": "Hopper"}, "frc488": {"loc":
@fangeugene
fangeugene / gist:cfc651a9eb80c66bc48ff91b0dbea833
Last active April 17, 2018 16:31
2018 RP by Team_Event (Updated Week 7)
frc254_2018casj 4.0
frc1678_2018cada 3.87
frc2590_2018pahat 3.83
frc2767_2018micmp4 3.66
frc195_2018necmp 3.66
frc2056_2018onham 3.66
frc2122_2018abca 3.58
frc2590_2018mrcmp 3.58
frc2056_2018oncmp1 3.58
frc1678_2018cafr 3.5
@fangeugene
fangeugene / f1m1.csv
Created February 19, 2018 00:32
2017week0 Time Series Scores
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 31 columns, instead of 22. in line 4.
time,matchKey,matchName,mode,timeRemaining,redScore,redForceCount,redForcePlayed,redLevitateCount,redLevitatePlayed,redBoostCount,redBoostPlayed,redScaleOwned,redSwitchOwned,redCurrentPowerup,redPowerupTimeRemaining,redAutoQuest,redFaceTheBoss,blueScore,blueForceCount,blueForcePlayed,blueLevitateCount,blueLevitatePlayed,blueBoostCount,blueBoostPlayed,blueScaleOwned,blueSwitchOwned,blueCurrentPowerup,bluePowerupTimeRemaining,blueAutoQuest,blueFaceTheBoss
2018-02-17 15:57:54.621448,f1m1,Final 1,auto,14,0,0,False,0,False,0,False,False,False,,,False,False,0,0,False,0,False,0,False,False,False,,,False,False
2018-02-17 15:57:55.621448,f1m1,Final 1,auto,13,0,0,False,0,False,0,False,False,False,,,False,False,0,0,False,0,False,0,False,False,False,,,False,False
2018-02-17 15:57:56.621448,f1m1,Final 1,auto,12,5,0,False,0,False,0,False,False,False,,,False,False,0,0,False,0,False,0,False,False,False,,,False,False
2018-02-17 15:57:57.621448,f1m1,Final 1,auto,11,5,0,False,0,False,0,False,False,False,,,False,False,0,0,False,
@fangeugene
fangeugene / 2017cmpmo_f1m2_timeseries.csv
Last active February 4, 2018 07:55
Time series score from TBA-GDCV
Time Mode Red Score Blue Score Red Fuel Blue Fuel Red Rotors Blue Rotors Red Touchpads Blue Touchpads
0 pre_match 0 0 0 + 0/9 0 + 0/9 0 0 0 0
14 auto 0 0 0 + 0/9 0 + 0/9 0 0 0 0
13 auto 0 0 0 + 0/9 0 + 0/9 0 0 0 0
12 auto 0 15 0 + 0/9 0 + 0/9 0 0 0 0
11 auto 15 15 0 + 0/9 0 + 0/9 0 0 0 0
10 auto 15 15 0 + 0/9 0 + 0/9 0 0 0 0
9 auto 15 15 0 + 0/9 0 + 0/9 0 0 0 0
8 auto 16 15 1 + 0/9 0 + 0/9 0 0 0 0
7 auto 21 15 6 + 0/9 0 + 0/9 0 0 0 0
@fangeugene
fangeugene / 2018_frc_registration.csv
Created November 20, 2017 04:36
2018 FRC Team Event Registration by time
Event Key Team Key Date Time (UTC)
2018azpx frc698 2017-09-28 18:34:16.021150
2018azpx frc991 2017-09-28 18:34:16.021360
2018azpx frc1290 2017-09-28 18:34:16.021540
2018azpx frc1492 2017-09-28 18:34:16.021670
2018azpx frc1633 2017-09-28 18:34:16.021980
2018azpx frc2375 2017-09-28 18:34:16.022310
2018azpx frc2403 2017-09-28 18:34:16.105460
2018azpx frc2647 2017-09-28 18:34:16.106810
2018azpx frc2662 2017-09-28 18:34:16.108040
@fangeugene
fangeugene / gist:deadce57948ce0e9e4a57160f8c5b8a1
Last active January 11, 2024 08:11
For downloading chats from Nightbot
import json
import urlfetch
url_format = 'https://api.nightbot.tv/1/logs?columns%5B0%5D%5Bdata%5D=createdAt&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=user.displayName&columns%5B1%5D%5Bname%5D=&columns%5B1%5D%5Bsearchable%5D=true&columns%5B1%5D%5Borderable%5D=false&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B2%5D%5Bdata%5D=message&columns%5B2%5D%5Bname%5D=&columns%5B2%5D%5Bsearchable%5D=true&columns%5B2%5D%5Borderable%5D=false&columns%5B2%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B2%5D%5Bsearch%5D%5Bregex%5D=false&order%5B0%5D%5Bcolumn%5D=0&order%5B0%5D%5Bdir%5D=desc&start={}&length=100&search%5Bvalue%5D=&search%5Bregex%5D=false'
offset = 0
all_messages = []
while True:
response = urlfetch.get(
@fangeugene
fangeugene / gist:122278a305b617db884b209485217a6b
Last active April 8, 2018 19:43
Script to accept Team Media suggestions
from consts.account_permissions import AccountPermissions
from consts.media_type import MediaType
from controllers.suggestions.suggestions_review_base_controller import SuggestionsReviewBaseController
from google.appengine.ext import ndb
import json
from models.media import Media
from models.suggestion import Suggestion
from helpers.suggestions.media_creator import MediaCreator
from helpers.media_manipulator import MediaManipulator
from helpers.user_bundle import UserBundle