Skip to content

Instantly share code, notes, and snippets.

Eric Cousineau EricCousineau-TRI

  • Toyota Research Institute
Block or report user

Report or block EricCousineau-TRI

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View callgrind.out.26178
This file has been truncated, but you can view the full file.
# callgrind format
version: 1
creator: callgrind-3.13.0
pid: 26178
cmd: ./bazel-bin/examples/Cassie/run_dircon_squatting --max_iter=1
part: 1
desc: I1 cache: 32768 B, 64 B, 8-way associative
View pydrake_custom_pickling_example.py
"""
We (TRI) used this pattern in Anzu (our internal app codebase) before some of
our classes supported pickling.
Here is how we support pickling an object that contained two classes that
were unpicklable:
- RigidTransform - now pickable, as of v0.10.0:
https://github.com/RobotLocomotion/drake/commit/3b559846
- Certain `pyassimp` objects (e.g. `pyassimp.structs.Scene` from
`pyassimp.load`).
View git_restore_for_older_git.sh
#!/bin/bash
# This allows for a "simple squash". This will be *greatly* simplified once
# newer version of Git (with `git restore`) are more widly available.
# Motivation behind this is to make a simple, commit-info-losing "squash" that
# helps Reviewable not make multiple revs:
# https://github.com/Reviewable/Reviewable/issues/592
# To run in shell, copy everything, including parentheses.
@EricCousineau-TRI
EricCousineau-TRI / no_prune.md
Last active Apr 22, 2020
No-Prune Branches in Git
View no_prune.md

If you're submitting PR's to a Git repo, then you generally may want to squash and/or rebase your commits to have a curated history. However, you may still have experiments that you run, where you may want a "permalink" to its history, and thus you would want to ensure that an unreachable commit (e.g. your commit before squashing or rebasing) does not get pruned when running some form of git gc.

I'm not sure if GitHub prevents pruning of explicit references to a given commit, but just in case, you may want to have a no_prune branch, and make sure you push to it (as --fast-forward only!).

To make one, just create the branch (off of whatever commit). Then, as you're making commits, merge using git merge --strategy=ours. For more information, see the

View 2020-04-21-git-name-rev.txt
$ git clone https://github.com/RobotLocomotion/drake.git
$ cd drake
$ git checkout 7530a95
$ git name-rev HEAD
HEAD tags/last_sha_with_original_matlab~313
$ git name-rev HEAD~20
HEAD~20 tags/last_sha_with_original_matlab~333
$ git name-rev 79e10e8
79e10e8 tags/last_sha_with_original_matlab~313^2
View bash_helper_functions.sh
export-prepend ()
{
eval "export $1=\"$2:\$$1\""
}
fhs-extend ()
{
local python_version=3;
while [[ $# -gt 0 ]]; do
case $1 in
View onnxruntime_issue2609.py
import numpy as np
import onnxruntime as ort
import torch
import torch.nn as nn
import torch.nn.functional as F
h = 32
w = 32
c = 1
View 2019-11-14-sdformat-semantic-pose-idea.cc
template <typename Class, typename... Args>
math::RigidTransformd ResolveRigidTransform(
const Class& element, Args... args) {
ignition::math::Pose3d pose;
ThrowAnyErrors(element.ResolvePose(args..., pose));
return ToRigidTransform(pose);
}
ResolveRigidTransform(link, model_frame)
View drake_pr12242_replace.py
#!/usr/bin/env python3
import os
from os.path import basename, dirname, abspath, join, isfile, splitext
from subprocess import run, check_output
import multiprocessing as mp
import re
files = [
# "attic/manipulation/scene_generation/test/test_random_clutter_to_rest.cc",
View blender_dump_race_spaceship_snippet.json
# Small JSON snippet using this stuff:
# https://github.com/EricCousineau-TRI/blender_server/blob/175054b15df1dc0b99795cc15fe80ef555d7dafa/blender_dump.py
...
"Cylinder.002": {
"_obj_id": 140067398049800,
"_path": "scenes['Scene'].collection.all_objects['Cylinder.002']",
"_relpath": "['Cylinder.002']",
"_type": "<class 'bpy_types.Object'>",
"animation_data": null,
"animation_visualization": {
You can’t perform that action at this time.