Skip to content

Instantly share code, notes, and snippets.

View PChild's full-sized avatar

Preston PChild

  • Blacksburg, VA
View GitHub Profile
@PChild
PChild / dcmpDivisions.py
Created May 16, 2019 03:20
My bad implementation of the FRC DCMP division algo
import gen
import math
import numpy
import random
import statistics as stat
def chunk(l, n):
'''
Splits a list l into a list of n new lists
'''
@PChild
PChild / slffPoints.py
Created July 14, 2018 02:24
SLFF points in python
def calcPoints(team, event):
teamMatches = tba.team_matches(team, event, None, True)
draftPoints = 0
rankPoints = 0
elimPoints = 0
if teamMatches != []:
try:
#Use team status instead of event_district_points since SLFF counts elims and awards points differently...
teamStats = tba.team_status(team, event)
@PChild
PChild / badMP.c
Last active October 18, 2017 17:38
Testing what happens with function-scoped static variables interacting with OpenMP
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
void foo(int rank)
{
static int x = 5;
x++;
printf("%d from %d\n", x, rank);
}
The stars at night are big and bright
Deep in the heart of Texas
The prairie sky is wide and high
Deep in the heart of Texas
The sage in bloom is like perfume
Deep in the heart of Texas
Reminds me of the one that I love
Deep in the heart of Texas
@PChild
PChild / cdUsers.py
Last active April 4, 2017 16:24
Script to scrape ChiefDelphi active users and record information about the users, their locations, and their teams. Trying to see how representative CD is of the FRC population as a whole.
import requests, geocoder
import pandas as pd
from bs4 import BeautifulSoup
from datetime import datetime
headers = {'X-TBA-App-Id': 'pchild:cdUsers:401'}
currentTime = datetime.now().strftime("%Y/%m/%d %H:%M")
def getTeamData(teamNumber):
print('Getting events for team ' + str(teamNumber))
module['exports'] = function team(hook) {
// hook.io has a range of node modules available - see
// https://hook.io/modules.
// We use request (https://www.npmjs.com/package/request) for an easy way to
// make the HTTP request.
var request = require('request-promise');
var cheerio = require('cheerio');
// The parameters passed in via the slash command POST request.