Skip to content

Instantly share code, notes, and snippets.

View rossbar's full-sized avatar

Ross Barnowski rossbar

  • Caltech
  • Pasadena, CA
View GitHub Profile
@rossbar
rossbar / vi_whitespace.md
Created September 18, 2015 17:39
Vim remove trailing whitespace

Remove trailing whitespace

  • From a current line:
:s/\s\+$//
  • From entire file:
@rossbar
rossbar / vi_file_switch.md
Created September 16, 2015 18:25
vi switch between files
:bn # Next file in buffer
:bp # previous file in buffer

Can map to in .vimrc like so:

nnoremap <C-Tab> :bn<CR>
nnoremap <C-S-Tab> :bp<CR>
@rossbar
rossbar / subtree.sh
Created September 16, 2015 02:11
Add a git repo's entire history to another git project with subtree
# /rel/path/to/subproject/folder should not be created yet
# <branch> is the branch of the subproject you want to include in the current project
# Source: http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/
git subtree add --prefix /rel/path/to/subproject/folder git@github.com:<user>/<subproject>.git <branch>
@rossbar
rossbar / pullall.sh
Last active September 18, 2015 17:43
Set up local repository to track all remote branches
# http://stackoverflow.com/questions/379081/track-all-remote-git-branches-as-local-branches
for remote in `git branch -r | grep -v /HEAD`; do git checkout --track $remote ; done
from setuptools import setup, find_packages, Extension
ext_modules=[Extension("spam", ["spam.c"])]
if __name__ == "__main__":
setup(
name="spam",
packages=find_packages(),
ext_modules=ext_modules,
)
@rossbar
rossbar / pony.sh
Created January 25, 2022 00:50
Generate per-line author data for pony factor
# replace `main` with name of default branch of repo @ pwd and output
for f in $(git ls-tree -r main --name-only); do git blame $f --line-porcelain | grep -I "^author " | cut -d" " -f2- >> authorship_by_line.txt; done
@rossbar
rossbar / yaml_to_camera_info_publisher.py
Last active July 30, 2023 12:15
ROS CameraInfo Publisher
"""
pointgrey_camera_driver (at least the version installed with apt-get) doesn't
properly handle camera info in indigo.
This node is a work-around that will read in a camera calibration .yaml
file (as created by the cameracalibrator.py in the camera_calibration pkg),
convert it to a valid sensor_msgs/CameraInfo message, and publish it on a
topic.
The yaml parsing is courtesy ROS-user Stephan:
http://answers.ros.org/question/33929/camera-calibration-parser-in-python/