Skip to content

Instantly share code, notes, and snippets.

Seth Battis battis

Block or report user

Report or block battis

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
@battis
battis / Current First Play Track.png
Last active Apr 23, 2019
Exploit iOS autoplay-on-connect bug for greater joy
@battis
battis / MecanumDrive.java
Created Jan 7, 2019
FTC MecanumDrive OpMode
View MecanumDrive.java
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
/**
* This is based on the helpful write-up at
* https://www.roboteq.com/index.php/component/easyblog/entry/driving-mecanum-wheels-omnidirectional-robots?Itemid=1208
* which itself is pulled from the Simplistic Control of Mecanum Drive from Ian McInerney, FRC Team 2022:
View musical_stairs.ino
/*
* Musical Stairs
*
* The core assumptions of this code mostly have to do with the sequence in which the
* XSHUT pins are wired together:
*
* 1. All of the XSHUT pins are contiguous on the Arduino, starting at XSHUT_OFFSET.
* 2. The pins are ordered L1, R1, L2, R2, ... , L10, R10
*
* At the moment, we are triggering a note to be played if REQ_CONSECUTIVE_BREAKS consecutive
@battis
battis / laser_time-of-flight_sensor_test.ino
Last active May 1, 2018
Laser Time-of-Flight Sensor Test (multiple sensors)
View laser_time-of-flight_sensor_test.ino
#include <Wire.h>
#include <VL53L0X.h>
const int NUM_SENSORS = 5;
const long SENSOR_TIMEOUT = 25;
const long MAX_TESTS = 100;
const long MAX_DURATION = 300000;
const int XSHUT_OFFSET = 2; // first XSHUT pin
VL53L0X sensors[NUM_SENSORS];
@battis
battis / laser_time-of-flight_sensor_test.ino
Created May 1, 2018
Laser Time-of-Flight Sensor Test
View laser_time-of-flight_sensor_test.ino
#include <Wire.h>
#include <VL53L0X.h>
const long SENSOR_TIMEOUT = 500;
const long MAX_TESTS = 1000;
const long MAX_DURATION = 300000; //ms
VL53L0X sensor;
int count = 0;
@battis
battis / start_tt-rss_daemon
Last active Feb 19, 2018
Start TT-RSS daemon in a detached screen (a 'cheap daemon' on multiuser servers)
View start_tt-rss_daemon
#!/usr/bin/expect -f
set screen "tt-rss"
set prompt "$"
set ttrss "~/public_html/tt-rss"
# open a new screen (reusing any existing 'tt-rss' screen)
spawn screen -D -R "$screen"
expect "$prompt"
View button_timing.ino
int buttonPin = 2;
int buttonState;
unsigned long timestamp;
void setup() {
// prepare ports for communication
pinMode(buttonPin, INPUT);
Serial.begin(9600);
@battis
battis / iTunesLibraryToggle
Last active Aug 21, 2018
Toggling between iTunes Libraries
View iTunesLibraryToggle
#!/usr/bin/env bash
#
# usage: iTunesLibraryToggle [library] [playlist]
# e.g. iTunesLibraryToggle "$HOME/Music/iTunes (Music & Audiobooks)" Audiobooks
iTunesLibraryToggle() {
# make sure the iTunes directory is, in fact, a symlink
iTunesDir=$HOME/Music/iTunes
if [[ ! -d "$iTunesDir" || -L "$iTunesDir" ]] ; then
@battis
battis / add_timezone_to_ics.php
Last active Jul 30, 2017
PHP Script to Add Time Zones to iCalendar/vCal Feeds
View add_timezone_to_ics.php
<?php
$filename = "calendar";
if (isset($_GET["url"])) {
$url = $_GET["url"];
if (!isset($_GET["show_url"])) {
preg_match("|.+\/([^?]+)\??|", $url, $matches);
if (isset ($matches[1])) {
@battis
battis / google_reader_to_wordpress.php
Created Jul 30, 2017
Transmogrifying those Google Reader JSON dumps into something useful
View google_reader_to_wordpress.php
/**********************************************************************
* Google Reader to Wordpress
*
* 2011-11-27
* Seth Battis (seth@battis.net)
*
* This script takes the output of Google Reader's JSON export of
* shared items and converts it into an XML file that can be imported
* into a Wordpress blog as posts. All of the data in the original JSON
* file is preserved in the XML file, either by transfering it to
You can’t perform that action at this time.