Skip to content

Instantly share code, notes, and snippets.

View EricCousineau-TRI's full-sized avatar

Eric Cousineau EricCousineau-TRI

View GitHub Profile
@EricCousineau-TRI
EricCousineau-TRI / asymkl.py
Created November 24, 2021 23:50 — forked from ariseff/asymkl.py
Visualizing KL divergence asymmetry with manim (community edition, 0.12.0)
%%manim -qm -v WARNING AsymKL
# https://gist.github.com/ariseff/cbcfd58d05abe7ec388bb4bbc9914ad9
"""
Source code for this visualization of KL divergence asymmetry:
https://twitter.com/ari_seff/status/1303741288911638530
KL computation is based on
https://tuananhle.co.uk/notes/reverse-forward-kl.html
Starting local Bazel server and connecting to it...
INFO: Invocation ID: bff3ef78-f166-4f3a-a430-a904678ac100
Loading: 0 packages loaded
currently loading: ... (5 packages)
Loading: 2 packages loaded
currently loading: ... (3 packages)
INFO: Repository ros2 instantiated at:
/home/eacousineau/proj/tri/repo/externals/drake-ros/ros2_example_bazel_installed/WORKSPACE:67:22: in <toplevel>
Repository rule ros2_local_repository defined at:
/mnt/data/eacousineau/cache/bazel/_bazel_eacousineau/c5b966ec842e9995a3ffda6de4f0a3d4/external/bazel_ros2_rules/ros2/defs.bzl:230:40: in <toplevel>
#include <pybind11/pybind11.h>
#include <spdlog/sinks/base_sink.h>
#include "drake/common/drake_throw.h"
#include "drake/common/text_logging.h"
namespace py = pybind11;
namespace anzu {
namespace {
import cv2
import numpy as np
def draw_text(
img,
*,
text,
uv_top_left,
color=(255, 255, 255),
$ bazel run //examples/instability:py/plant_hidden_state_test
...
[ good 0 ]
Setup(discrete_plant=False, add_contact_viz=True, add_zoh=True, add_latch=True, clean_plant_state=False)
Initialize: 0
t: 0.0
x_a: [0.125 0. ]
u: [-0.125]
Initialize: 1
import os
from rmw_isolation import generate_isolated_rmw_env
def make_unique_ros_isolation_env(
*,
unique_identifier=None,
scratch_directory=None,
environ=os.environ,
# NVLIBLIST.CONF
# This configuration file determines which NVIDIA libraries to search for on
# the host system when the --nv option is invoked. You can edit it if you have
# different libraries on your host system. You can also add binaries and they
# will be mounted into the container when the --nv option is passed.
# put binaries here
# In shared environments you should ensure that permissions on these files
# exclude writing by non-privileged users.
nvidia-smi
# https://wiki.debian.org/Packaging/SourcePackage
apt-cache policy python3-pyassimp
# Focal
vim /etc/apt/sources.list
# Uncomment line: deb-src http://archive.ubuntu.com/ubuntu/ focal universe
apt update
apt-cache showsrc python3-pyassimp
# See "Vcs-Git"
@EricCousineau-TRI
EricCousineau-TRI / build.sh
Last active November 19, 2022 22:41
apptainer w/ no need for sudo to build / run
Moved to https://github.com/EricCousineau-TRI/repro/blob/master/shell/apptainer_stuff/build_and_install_apptainer.sh
Permalink: https://github.com/EricCousineau-TRI/repro/blob/6f0681f7/shell/apptainer_stuff/build_and_install_apptainer.sh
@EricCousineau-TRI
EricCousineau-TRI / bash_env_isolate.sh
Last active October 19, 2022 11:00
bash_helpers_functions - env-isolate, bash-isolate, fhs-extend
# Use this to run things in a pristine environment.
alias env-isolate='env -i HOME=$HOME DISPLAY=$DISPLAY SHELL=$SHELL TERM=$TERM USER=$USER PATH=/usr/sbin:/usr/bin:/bin'
alias bash-isolate='env-isolate bash --norc'