Skip to content

Instantly share code, notes, and snippets.

Auxiliary-Character auxiliary-character

Block or report user

Report or block auxiliary-character

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dice.js
function getRandomInt (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function die(sides){
return getRandomInt(1,sides);
}
function dice(dice,sides){
var total = 0;
View wat.php
<?php
function getTopPlayers($mysqli, $dbPrefix, $stat, $page)
{
$query;
switch ($stat) {
//irrelevant stuff removed
default:
$query = "SELECT player_id,SUM(?) AS value FROM {?}player "
View exampleplayer.yaml
header: !!python/tuple
- !!binary |
Uw==
- !!binary |
Qg==
- !!binary |
Vg==
- !!binary |
Sg==
- !!binary |
View scanner.lua
--Based on /u/ThatParadox's code. http://redd.it/2atn8f
--To use:
--pastebin get nD6eVHwy startup
for _,side in pairs(rs.getSides()) do
if peripheral.getType(side) == "ender_chest" then
chest = peripheral.wrap(side)
print("Found chest on "..side.." side.")
break
end
end
View conway.js
function isAlive(state, x, y) {
var count=0;
for(var i=-1;i<=1;i++){
for(var j=-1;j<=1;j++){
if(!(j===0&&i===0)){
var xIndex = (i+x+state.length)%(state.length);
var yIndex = (j+y+state[xIndex].length)%(state[xIndex].length);
if(state[xIndex][yIndex]){
count++;
}
View Markdown test.md

Test

This is a test document. Lorem ipsum set amore, etc etc.

local f = function(x)
    return x*x + 2*x + 4
end
@auxiliary-character
auxiliary-character / PID_Fragment.py
Last active Aug 29, 2015
Some helper code for the PID controller.
View PID_Fragment.py
import math
def returnPIDInput(self):
angle = self.gyro.getAngle()
set_point = self.pid_controller.getSetPoint()
angle_greater = angle + 2*math.pi
angle_lesser = angle - 2*maht.pi
use_angle = math.fabs(angle-set_point) < math.fabs(angle_greater - set_point)
use_angle = use_angle and math.fabs(angle-set_point) < math.fabs(angle_lesser - set_point)
View imu_simple.py
import threading
import wpilib
import serial
import re
class IMUSimple(threading.Thread):
float_regex = """([\+\-]\d{3}\.\d{2})"""
int8_regex = """([0-9A-Fa-f]{2})"""
int16_regex = """([0-9A-Fa-f]{4})"""
termination_regex = int8_regex + "\n\r"
View timer_example.py
#!/usr/bin/env python3
from wpilib import Timer
def main():
start_time = Timer.getFPGATimestamp()
now = start_time
while now < start_time + 5:
do_stuff()
now = Timer.getFPGATimestamp()
Timer.delay(.001)
View mast_button.py
from wpilib.command import Command
class MastButton(Command):
def __init__(self, robot, speed):
super().__init__()
self.robot = robot
self.requires(self.robot.lift)
self.speed = speed
def execute(self):
You can’t perform that action at this time.