Skip to content

Instantly share code, notes, and snippets.

@jsburklund
jsburklund / show_cpu_usage.cpp
Created July 26, 2019 08:26
Simple process to discover how CPU usage stats are aggregated with different tools
// Simple test to discover how process stats aggregate CPU usage
// Building: g++ -std=c++11 main.cpp -o mymain -lpthread
#include <chrono>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <thread>
volatile float a, b;
@jsburklund
jsburklund / sql_update.vim
Created September 4, 2018 15:03
Adds syntax highlighting for arithmetic operators
" Update Syntax for SQL
au BufRead,BufNewFile *.sql syn match sqlConditional "=\|<\|>\|+\|-\|(\|)"
au BufRead,BufNewFile *.sql syn match sqlComment "--.*$" contains=sqlTodo,@Spell
au BufRead,BufNewFile *.sql hi link sqlConditional Conditional
@jsburklund
jsburklund / subdir_execute.sh
Created August 28, 2018 03:54
Do something in a particular set of subdirectories
for D in `find . -type d -name "2018-0[6,7]-??"`
do
echo "" > $D/symphony.py.log
echo "" > $D/airflow-log-cleanup.py.log
# Do other stuff in the subdirectory
done
@jsburklund
jsburklund / creatacard_notes.md
Last active December 23, 2018 19:27
Notes and instructions for running Create A Card on Mint/Linux

Installing Wine

  1. wget -qO - https://dl.winehq.org/wine-builds/Release.key | sudo apt-key add -
  2. sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main'
  3. sudo apt update
  4. sudo apt install --install-recommends winehq-stable

Update GPG Key for Wine

  1. wget -nc https://dl.winehq.org/wine-builds/winehq.key
  2. sudo apt-key add winehq.key
  3. rm winehq.key
@jsburklund
jsburklund / sql_parser
Created July 31, 2018 04:59
Parse SQL files for variables and replace them with python
def parser(filename, values):
with open(filename, 'r') as f:
sql_text = f.read()
sql_text = sql_text.replace("$[", "{")
sql_text = sql_text.replace("]", "}")
sql_text = sql_text.format(**values)
print(sql_text)
if __name__=='__main__':
parser("test.sql", {"year": 2018})
@jsburklund
jsburklund / plot_stuff.py
Created May 1, 2018 05:46
Plotting PID controller results vs desired trajectories
import rosbag
from geometry_msgs.msg import PoseStamped, TwistStamped
import matplotlib.pyplot as plt
import numpy as np
import sys
print(sys.argv[1])
bag = rosbag.Bag(sys.argv[1], 'r')
@jsburklund
jsburklund / betterviz.patch
Created April 30, 2018 15:59
Improves LED visualization of Footbots by ripping off the top
From 7d37dcd1f8a3157da286bf957412271720fd1119 Mon Sep 17 00:00:00 2001
From: jsburklund <robomower9508@gmail.com>
Date: Mon, 30 Apr 2018 11:53:15 -0400
Subject: [PATCH] Rip off the top of footbots for better visualization
---
.../robots/foot-bot/simulator/qtopengl_footbot.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/plugins/robots/foot-bot/simulator/qtopengl_footbot.cpp b/src/plugins/robots/foot-bot/simulator/qtopengl_footbot.cpp
@jsburklund
jsburklund / SImplePacketComsJavaTest.groovy
Created April 24, 2018 16:57 — forked from madhephaestus/SImplePacketComsJavaTest.groovy
Test the simple packet coms Java API
@Grab(group='com.neuronrobotics', module='SimplePacketComsJava', version='0.0.3')
import edu.wpi.SimplePacketComs.bytepacket.BytePacketType;
import edu.wpi.SimplePacketComs.floatpacket.FloatPacketType;
import edu.wpi.SimplePacketComs.*;
import edu.wpi.SimplePacketComs.phy.UDPSimplePacketComs;
import java.net.InetAddress;
import java.util.HashSet;
class SwarmRobot extends NonBowlerDevice{
@jsburklund
jsburklund / Glyph_Pipeline.grip
Created November 26, 2017 21:28
Pipeline for finding cubes in the 2018 FTC game.
<grip:Pipeline>
<sources>
<grip:ImageFile>
<property name="path" value="glyph2.jpg"/>
</grip:ImageFile>
</sources>
<steps>
<grip:Step name="CV resize">
<grip:Input step="0" socket="0"/>
<grip:Input step="0" socket="1"/>
@jsburklund
jsburklund / NetworkManager.conf.ap
Created November 2, 2017 23:27
TX2 wifi AP Mode files
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq
[ifupdown]
managed=false