Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Cousineau EricCousineau-TRI

View GitHub Profile
View vector_gather.py
import einops
import torch
def vector_gather(vectors, indices):
"""
Gathers (batched) vectors according to indices.
Arguments:
vectors: Tensor[N, L, D]
indices: Tensor[N, K] or Tensor[N]
@EricCousineau-TRI
EricCousineau-TRI / asymkl.py
Created Nov 24, 2021 — forked from ariseff/asymkl.py
Visualizing KL divergence asymmetry with manim (community edition, 0.12.0)
View asymkl.py
%%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
View google-research-ibc-issue1-info.txt
$ git log -n 1 --oneline --no-decorate
3d5dcfb Internal change
$ pip freeze
absl-py==0.12.0
astunparse==1.6.3
backcall==0.2.0
cachetools==4.2.4
certifi==2021.10.8
charset-normalizer==2.0.7
View harddrive_luks_setup.sh
#!/bin/bash
set -eux
# Encrypts an *entire* harddrive and creates an ext4 filesystem on the full drive.
# Based on: https://www.howtoforge.com/automatically-unlock-luks-encrypted-drives-with-a-keyfile
#
# Example usage, assuming "sdX" is the *ENTIRE* harddrive you want to encrypt and format.
# This will prompt you for `sudo` password, and then will have additional LUKS prompts.
# BE VERY CAREFUL!
#
View gist:c9d429bf1ecf552c2b6eaa71004aca58
#!/bin/bash
shopt -s expand_aliases
# Related articles:
# - https://developer.mozilla.org/en-US/docs/Mozilla/QA/Desktop_Firefox_Reporting_and_Writing_Good_Bugs#all
# - https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode
# - https://cat-in-136.github.io/2012/12/tip-how-to-run-new-firefox-instance-w.html
alias env-isolate='env -i HOME=$HOME DISPLAY=$DISPLAY SHELL=$SHELL TERM=$TERM USER=$USER PATH=/usr/local/bin:/usr/bin:/bin _ISOLATED=1'
alias bash-isolate='env-isolate bash --norc'
View PlasticineLab_issue3_pip_freeze.txt
absl-py==0.13.0
astor==0.8.1
astunparse==1.6.3
atari-py==0.2.9
baselines==0.1.5
cached-property==1.5.2
cachetools==4.2.2
certifi==2021.5.30
cffi==1.14.6
charset-normalizer==2.0.3
View darke_pr15290_ci_flake.txt
INFO: From Testing //manipulation/util:py/show_model_test:
...
model: multibody/benchmarks/acrobot/acrobot.sdf
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/matplotlib/font_manager.py", line 1448, in <module>
fontManager = json_load(_fmcache)
File "/usr/lib/python3/dist-packages/matplotlib/font_manager.py", line 977, in json_load
with open(filename, 'r') as fh:
FileNotFoundError: [Errno 2] No such file or directory: '/home/ubuntu/.cache/matplotlib/fontList.json'
View pipx_pybind11_config.sh
$ python3 -m venv . && source ./bin/activate
$ pip install -U pip wheel && pip install pipx
# Does not work
$ pipx run pybind11 --includes
'pybind11' executable script not found in package 'pybind11'. Available executable scripts: pybind11-config
# Works.
$ pipx run --spec pybind11 pybind11-config --includes
-I/usr/include/python3.6m -I/home/eacousineau/.local/pipx/.cache/8177cc6c865ad67/lib/python3.6/site-packages/pybind11/include
View monado_build.sh
#!/bin/bash
set -eux
prefix=~/.local/opt/monado/1.0
jobs="-j 10"
export-prepend() {
eval "export $1=\"$2:\${$1:-}\""
}
@EricCousineau-TRI
EricCousineau-TRI / conda_list.txt
Created Jun 4, 2021
deformable-ravens/issues/4
View conda_list.txt
# conda list --export
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
_libgcc_mutex=0.1=main
_tflow_select=2.1.0=gpu
absl-py=0.12.0=py37h06a4308_0
aiohttp=3.7.4=py37h27cfd23_1
astor=0.8.1=py37h06a4308_0