This file contains hidden or 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
## https://unix.stackexchange.com/a/22215 | |
## find_up filename | |
find_up () { | |
path=$(pwd) | |
while [[ "$path" != "" && ! -e "$path/$1" ]]; do | |
path=${path%/*} | |
done | |
echo "$path" | |
} |
This file contains hidden or 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 -vS tmuxinator start -p | |
# rename to .tmuxinator.yml and run `tmuxinator start` | |
# OR run `tmuxinator start -p custom_filename.yml` | |
# OR make executable and run with shebang | |
name: my-session | |
on_project_start: cd ~ | |
on_project_exit: tmux kill-session -t my-session | |
windows: |
This file contains hidden or 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
from sklearn.datasets import load_iris | |
import pandas as pd | |
import numpy as np | |
from sklearn.model_selection import KFold | |
from sklearn import metrics | |
from sklearn.linear_model import LinearRegression | |
df = load_iris(return_X_y=True, as_frame=True) | |
X = df[0] |
This file contains hidden or 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
OPENCV_VER="master" | |
TMPDIR=$(mktemp -d) | |
# Build and install OpenCV from source. | |
cd "${TMPDIR}" | |
git clone --branch ${OPENCV_VER} --depth 1 --recurse-submodules --shallow-submodules https://github.com/opencv/opencv-python.git opencv-python-${OPENCV_VER} | |
cd opencv-python-${OPENCV_VER} | |
export ENABLE_CONTRIB=1 | |
export ENABLE_HEADLESS=0 | |
# We want GStreamer support enabled. |
This file contains hidden or 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/bash | |
# | |
# This bash quickie lists your connected v4l2 cameras by parsing the output of `v4l2-ctl --list-devices`. | |
# Useful when playing w/ external cameras since replugging will usually modify its /dev/videoX location | |
# | |
# Example output | |
# ``` | |
# C: | |
# | |
# #define CAM_0 "/dev/video2" |
This file contains hidden or 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/bash | |
# This bash scripts takes the stderr from RidgeRun's Gst-Shark interlatency | |
# tracer and parses its output to build some tables averaging results. | |
# | |
# Install gst shark and wrap your pipeline as: | |
# $ GST_DEBUG="GST_TRACER:7" GST_TRACERS="interlatency" \ | |
# gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink \ | |
# 2> tracer.log | |
# |
This file contains hidden or 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/bash | |
# This script to plot an array of 4 cameras with gstreamer | |
# | |
# To have them in sequence, define d0-d3 in increasing order, then circle your | |
# hand through all cameras. Change d0-d3 to the order your hand appears in. | |
# Then, you'll get a spatially coherent display of cameras next to each other. | |
# Ids from /dev/videoXX, get with `$ gst-device-monitor-1.0 | grep v4l2src` | |
d0=7 |
This file contains hidden or 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
''' | |
Actor critic learning of linearized mountain car. | |
Critic: Linear action-value with function approximation, TD(0). | |
Actor: gradient ascent with softmax policy, based on action-value function. | |
''' | |
import matplotlib | |
import numpy as np | |
import gym |
NewerOlder