Skip to content

Instantly share code, notes, and snippets.

View loganzartman's full-sized avatar
🏳️‍🌈
support civil liberties

Logan loganzartman

🏳️‍🌈
support civil liberties
View GitHub Profile
@loganzartman
loganzartman / arch-ros-tricks.md
Last active January 19, 2021 00:53
ROS installation/etc tricks on arch linux

no warranty express or implied

Install/Remove

  • install instructions
  • (bad practice) minimal install w/ trizen:
    trizen --noconfirm --sudo-autorepeat-at-runtime -Sy ros-melodic-ros-base
    • might need to set sudo_remove_timestamp => 0 in ~/.config/trizen/trizen.conf
  • remove all ROS packages:
    sudo pacman -Rs $(pacman -Qsq ros-melodic-)

Troubleshooting

@loganzartman
loganzartman / catkin_install.sh
Created June 12, 2020 00:36
Install catkin packages on Arch
# this sucks
# you will need to chmod some /opt/ros/melodic directories for make install to work...
# feel free to tell me how to actually do this
source /usr/share/ros-build-tools/clear-ros-env.sh
source /opt/ros/melodic/setup.bash
mkdir build
cd build
/usr/share/ros-build-tools/fix-python-scripts.sh -v 3 ..
@loganzartman
loganzartman / findros.py
Last active March 16, 2020 18:24
Automatically connect to an unused lab machine with ROS
#!/usr/bin/env python3
import asyncio
import subprocess
import sys
from random import shuffle
from argparse import ArgumentParser
def get_machines(username):
print("Getting list of CS hosts...", file=sys.stderr)
@loganzartman
loganzartman / compose_dead_greek.py
Last active January 27, 2020 18:09
adds dead_greek-like bindings for compose key
#!/usr/bin/env python3
"""
usage:
chmod +x compose_dead_greek.py
./compose_dead_greek.py
"""
import os.path
"Install vim-plug
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Install missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
@loganzartman
loganzartman / star-run.py
Created April 5, 2019 07:38
termpixels demo
"""
star-run.py
dependencies: termpixels 0.0.6 (via pip)
"""
import operator
import math
from random import uniform
from termpixels import App, Color
"""@package tester
Test harness for kmeans
"""
from math import floor
import sys
import subprocess
import multiprocessing
import csv_mt
@loganzartman
loganzartman / csv_mt.py
Created April 29, 2018 20:29
Multi-table CSV parser
"""@package csv_mt
csv_mt allows reading of a multi-table CSV format described as follows:
Table name
header 1,header 2,header 3
data1,data1,data1
data2,data2,data2
{blank line}
There may be as many tables as desired in a single input. Tables should be
import matplotlib.pyplot as plt
def plot_bars(barGroups, barNames, groupNames, colors, ylabel="", title="", width=0.8):
"""Plot a grouped bar chart
barGroups - list of groups, where each group is a list of bar heights
barNames - list containing the name of each bar within any group
groupNames - list containing the name of each group
colors - list containing the color for each bar within a group
ylabel - label for the y-axis
title - title
@loganzartman
loganzartman / rpn_tester.js
Created February 28, 2018 00:17
Note: run `npm install long` in the same directory before using
const long = require("long");
const execSync = require("child_process").execSync;
const fs = require("fs");
const N = 5, M = 40, UNTIL_FAIL = true;
const MAX64 = long.MAX_VALUE;
const MIN64 = long.MIN_VALUE;
const BIN = {
"+": function(a,b) {return a.add(b)},
"-": function(a,b) {return b.sub(a)},