Skip to content

Instantly share code, notes, and snippets.

View DuaneNielsen's full-sized avatar
👾
Happy!

Duane DuaneNielsen

👾
Happy!
View GitHub Profile
mujoco in ~/.mujoco/mujoco200 (may need to rename)
ln -s ~/.mujoco/mujoco200 ~/.mujoco/mujoco200_linux
mujuco key in ~/.mujoco/mjkey.txt
sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3
sudo apt-get install libglew-dev
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/duane/.mujoco/mujoco200/bin
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_TIMEOUT_STYLE=menu
@DuaneNielsen
DuaneNielsen / activate
Last active December 2, 2020 03:38
Add specific CUDA to python venv
# open the <env_name>/bin/activate
# add the below lines to the bottom
#
# CUDA 11.0
LD_LIBRARY_PATH="/usr/local/cuda-11.0/lib64"
export LD_LIBRARY_PATH
PATH="/usr/local/cuda-11.0/bin:$PATH"
export PATH
import pygame, sys
from pygame.locals import *
import numpy as np
from math import radians, degrees
from numpy import cos, sin
from numpy.linalg import inv
from collections import OrderedDict
# Set up pygame
pygame.init()
@DuaneNielsen
DuaneNielsen / matplotlib_oo_demo.py
Created October 31, 2020 19:43
How to OO in matplotlib
from matplotlib import pyplot as plt
#rows, columns
layout = (2, 1)
fig = plt.figure(figsize=(12, 12), dpi=80)
fig.canvas.set_window_title(title='matplotlib object oriented demo')
positions = fig.add_subplot(*layout, 1, )
import torch
from matplotlib import pyplot as plt
def cross_matrix(axis):
"""
Returns the skew symetric matrix given a vector omega
:param omega: 3D axis of rotation
:return: skew symmetric matrix for axis
@DuaneNielsen
DuaneNielsen / torch_autograd_viz.cpp
Created October 4, 2020 00:29
Example of creating dot file of libtorch computation graph in c++
//
// Created by duane on 10/2/20.
//
#include <torch/torch.h>
int main(int arg, char *argv[]){
auto x = torch::randn(3, torch::requires_grad());
auto z = torch::randn(3, torch::requires_grad());
@DuaneNielsen
DuaneNielsen / CMakeLists.txt
Created September 19, 2020 01:31
ROS_Tutorial
cmake_minimum_required(VERSION 3.5)
project(ros2_cpp_pkg)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
from vpython import sphere, vector, rate, color, arrow, canvas, cross, triangle, vertex
from math import sqrt
G = 6.67e-11 # N kg^-2 m^2
au = 1.495978707e11
day = 60 * 60 * 24
year = day * 365.25
earth_mass = 5.972e24 # kg
import glfw
from OpenGL.GL import *
from OpenGL.GL.shaders import compileProgram, compileShader
import numpy as np
import pyrr
def init_window(width, height, title="My OpenGL window"):
# initializing glfw library
if not glfw.init():