Skip to content

Instantly share code, notes, and snippets.

Avatar

Ross Barnowski rossbar

  • Berkeley Institute for Data Science (BIDS)
  • Berkeley, CA
View GitHub Profile
@rossbar
rossbar / pony.sh
Created Jan 25, 2022
Generate per-line author data for pony factor
View pony.sh
# 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
View setup.py
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,
)
View yaml_to_camera_info_publisher.py
"""
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/
@rossbar
rossbar / vi_whitespace.md
Created Sep 18, 2015
Vim remove trailing whitespace
View vi_whitespace.md

Remove trailing whitespace

  • From a current line:
:s/\s\+$//
  • From entire file:
@rossbar
rossbar / vi_file_switch.md
Created Sep 16, 2015
vi switch between files
View vi_file_switch.md
: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 Sep 16, 2015
Add a git repo's entire history to another git project with subtree
View subtree.sh
# /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 Sep 18, 2015
Set up local repository to track all remote branches
View pullall.sh
# 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