Skip to content

Instantly share code, notes, and snippets.

@calebreister
calebreister / resistors.js
Last active September 3, 2015 06:40
Very useful JavaScript that can approximate a given resistor value using parallel and series configurations. (http://www.qsl.net/in3otd/parallr.html)
//<![CDATA[
/* Copyright (C) 2001-2010 Claudio Girardi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
@calebreister
calebreister / ParseHeader.py
Created August 10, 2014 02:28
This script parses a C or C++ header and generates an implementation file based on the function prototypes found within. It is designed to take one class or namespace at a time, so the scope resolution is based off of the header file's name.
#!/usr/bin/env python3
#This program parses C/C++ header files and outputs a corresponding
#implementation file. It uses a regular expression to isolate function
#prototypes and converts them to implementations.
#This program is designed to take a single class or namespace as input.
import sys
import os
import re
@calebreister
calebreister / sonicRead.cc
Created April 3, 2014 17:05
This could be useful for some people involved in FIRST robotics, but I posted it in order to get it logic-checked.
//earlier in the program I run this to initialize the array
for (int i = 0; i < SONIC_SAMPLE * 2; i++)
sonicRead();
//Averages and returns the inch reading of the ultrasonic sensor
//Updates sonicHotZone
SonicData robot::sonicRead()
{
SonicData out;
out.avg = 0;
@NoobsArePeople2
NoobsArePeople2 / install_sfml_deps.sh
Last active April 6, 2022 09:08
Install SFML dependencies on Ubuntu Linux
#!/usr/bin/bash
# Install CMake GUI
sudo apt-get install cmake-gui
# SFML Dependencies
sudo apt-get install libpthread-stubs0-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libx11-dev
sudo apt-get install libxrandr-dev