This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pid_controller(y, yc, h=1, Ti=1, Td=1, Kp=1, u0=0, e0=0) | |
"""Calculate System Input using a PID Controller | |
Arguments: | |
y .. Measured Output of the System | |
yc .. Desired Output of the System | |
h .. Sampling Time | |
Kp .. Controller Gain Constant | |
Ti .. Controller Integration Constant | |
Td .. Controller Derivation Constant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TARGETLINK=https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.2-linux-x86_64.tar.gz | |
VERSION=1.6.2 | |
CURDIR=$(pwd) | |
set -e | |
set -x | |
ARCHIVE=julia-$VERSION.tar.gz | |
wget $TARGETLINK -O $ARCHIVE | |
UNCOMPRESSED_SIZE=$(zcat $ARCHIVE | wc -c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import subprocess | |
import socket | |
from contextlib import closing | |
import threading | |
import time | |
import os | |
import signal | |
import argparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cross-entropy optimization | |
import numpy as np | |
import tqdm | |
def ce_minimize(X_mean, X_std, eval_loss, iterations=100, sample_size=25, keep_samples=10): | |
assert 0 < sample_size | |
assert 0 < keep_samples and keep_samples < sample_size | |
# Alg settings: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Dark magic for interactive python.""" | |
import builtins | |
import time | |
def ipy_here(leak_variables=True): | |
import IPython | |
import inspect | |
parent_frame = inspect.currentframe().f_back |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import importlib | |
import subprocess | |
import re | |
import os | |
import joblib | |
from joblib import parallel_backend, Parallel, delayed | |
found_imports = sorted(list(set([x.lstrip().rstrip() for x in subprocess.check_output("findimports -p -l 1 |grep -v ':' |sort -u", shell=True).decode("utf-8").rstrip().lstrip().split("\n")]))) | |
installed_packages = subprocess.check_output('pip list | tail -n +3 | cut -d" " -f1', shell=True).decode("utf-8").rstrip().lstrip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; diction.el --- minor mode to interface the command diction | |
;;; Copyright Sven Utcke <Sven.Utcke@gmx.de> | |
;; Emacs Lisp Archive Entry | |
;; Filename: diction.el | |
;; Version: $Id: diction.el,v 1.8 2005/09/29 12:55:52 utcke Exp $ | |
;; Keywords: diction, style | |
;; Author: Sven Utcke <Sven.Utcke@gmx.de> | |
;; Maintainer: Sven Utcke <Sven.Utcke@gmx.de> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a selection of small numpy helper functions | |
import joblib | |
def apply_along_axes(func, data, axes): | |
""" | |
apply function along axes and use joblib parallel to execute the function on the selections. | |
might result in a large allocation for reconstructing the result. | |
only makes sense if the sub-executions are sufficiently costly. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
JointInfo = collections.namedtuple( | |
"JointInfo", | |
[ | |
"index", | |
"name", | |
"type", | |
"q_index", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -x | |
# you can directly run this with: bash <(curl -Ls "https://gist.githubusercontent.com/jkbjh/c83e5bf6d708f590f77ccdd6b2ef0a40/raw/mujoco-210-user-install.sh?$(date +%s)") | |
# (the date query parameter is to to prevent caching when downloading through curl.) | |
export START_DIR=$(pwd) | |
export MJ_DIR=$HOME/.mujoco | |
mkdir -p $MJ_DIR | |
pushd $MJ_DIR | |
curl -LJ 'https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz' -o $MJ_DIR/mujoco210_linux.tgz |
OlderNewer