Skip to content

Instantly share code, notes, and snippets.

View PeterJohnson's full-sized avatar

Peter Johnson PeterJohnson

  • Pasadena, California
View GitHub Profile
@PeterJohnson
PeterJohnson / roster-migrate-v1v2.py
Created September 8, 2011 04:25
roster v1 to v2 database conversion
#!/usr/bin/env python
import os
import json
if __name__ == "__main__":
import sys
print "Importing json..."
data = json.load(open(sys.argv[1]))
print "Mapping person..."
@PeterJohnson
PeterJohnson / detect_requirements_package.sh.patch
Created August 29, 2015 00:29
Patch to fix package creation for fglrx-14.502.1040
--- a/detect_requirements_package.sh 2015-08-03 10:13:42.000000000 -0700
+++ b/detect_requirements_package.sh 2015-08-24 22:40:41.352391977 -0700
@@ -100,7 +100,7 @@
distro="RHEL"
fi
-if [ $distro="SuSE" -o $distro="RHEL" ];
+if [ "$distro" = "SuSE" -o "$distro" = "RHEL" ];
then
#include <chrono>
#include <cstdio>
#include <thread>
#include "ntcore.h"
int main() {
nt::StartServer("persistent2.ini", "", 10000);
std::this_thread::sleep_for(std::chrono::seconds(1));
nt::DeleteAllEntries();
@PeterJohnson
PeterJohnson / .clang-format
Created January 2, 2016 18:01
clang-format for ntcore and wpilib
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
import edu.wpi.first.wpilibj.networktables.*;
import edu.wpi.first.wpilibj.tables.*;
public class Listener {
private static class MyListener implements ITableListener {
public void valueChanged(ITable source, String key, Object value, boolean isNew) {
System.out.println("value changed: " + key + " isNew=" + isNew);
}
}
public static void main(String[] args) {
#0 0x00000000 in ?? ()
#1 0x001f8578 in std::_Function_base::~_Function_base (this=0x456a24,
__in_chrg=<optimized out>)
at /usr/arm-frc-linux-gnueabi/include/c++/4.8.2/functional:2030
#2 0x0021f420 in std::function<void ()>::~function() (this=0x456a24,
__in_chrg=<optimized out>)
at /usr/arm-frc-linux-gnueabi/include/c++/4.8.2/functional:2174
#3 0x002875f4 in Notifier::~Notifier (this=0x4569e0, __in_chrg=<optimized out>)
at /home/peter/project/frc/allwpilib/wpilibc/athena/src/Notifier.cpp:32
#4 0x002bdb4c in __gnu_cxx::new_allocator<Notifier>::destroy<Notifier> (this=0x4569dc,
> Building 93% > :ui:jfxRunJul 29, 2016 4:29:53 PM java.util.logging.LogManager$RootLogger log
CONFIG: Configuration done.
Jul 29, 2016 4:29:53 PM java.util.logging.LogManager$RootLogger log
CONFIG: GRIP Version: 1.4.0-56-g58635d3
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in Application init method
java.lang.reflect.InvocationTargetException
import edu.wpi.first.wpilibj.AnalogInput;
import edu.wpi.first.wpilibj.AnalogOutput;
import edu.wpi.first.wpilibj.IterativeRobot;
@SuppressWarnings("all")
public class MyRobot extends IterativeRobot {
AnalogInput a0, a1, a2, a3;
AnalogOutput aout0;
public void robotInit() {
a0 = new AnalogInput(0);
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
evaluationDependsOn(':wpilibj')
mainClassName = 'edu.wpi.first.wpilibj.RobotBase'
buildscript {
repositories { jcenter() }
@PeterJohnson
PeterJohnson / CameraServer.h
Created November 17, 2016 06:56
CameraServer API
class CameraServer : public ErrorBase {
public:
static constexpr uint16_t kBasePort = 1181;
static constexpr int kSize640x480 = 0;
static constexpr int kSize320x240 = 1;
static constexpr int kSize160x120 = 2;
public:
static CameraServer* GetInstance();