Instantly share code, notes, and snippets.

# Auxiliary-Characterauxiliary-character

• Sort options
Last active Aug 29, 2015
Dice
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;
Last active Aug 29, 2015
View wat.php

Created Jul 14, 2014
View exampleplayer.yaml
 header: !!python/tuple - !!binary | Uw== - !!binary | Qg== - !!binary | Vg== - !!binary | Sg== - !!binary |
Last active Aug 29, 2015
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
Created Nov 16, 2014
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++; }
Created Dec 6, 2014
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
``````
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)
Created Jan 22, 2015
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"
Last active Aug 29, 2015
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)
Created Feb 15, 2015
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.