Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import numpy as NP | |
import math | |
def isclose(x, y, rtol=1.e-5, atol=1.e-8): | |
return abs(x-y) <= atol + rtol * abs(y) | |
def euler_angles_from_rotation_matrix(R): | |
''' | |
From a paper by Gregory G. Slabaugh (undated), | |
"Computing Euler angles from a rotation matrix |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
import numpy as np | |
from keras.models import Sequential | |
from keras.layers.core import Activation, Dense | |
from keras.optimizers import SGD | |
X = np.array([[0,0],[0,1],[1,0],[1,1]], "float32") | |
y = np.array([[0],[1],[1],[0]], "float32") | |
model = Sequential() | |
model.add(Dense(2, input_dim=2, activation='sigmoid')) |
# This code is based on tutorial by slicktechies modified as needed to use oauth token from Twitch. | |
# You can read more details at: https://www.junian.net/2017/01/how-to-record-twitch-streams.html | |
# original code is from https://slicktechies.com/how-to-watchrecord-twitch-streams-using-livestreamer/ | |
import requests | |
import os | |
import time | |
import json | |
import sys | |
import subprocess |
#!/bin/bash | |
# | |
# EDIT: this script is outdated, please see https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-6-0-now-available | |
# | |
sudo apt-get install python-pip | |
# upgrade pip | |
pip install -U pip | |
pip --version | |
# pip 9.0.1 from /home/ubuntu/.local/lib/python2.7/site-packages (python 2.7) |
import os | |
import yaml | |
import logging.config | |
import logging | |
import coloredlogs | |
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'): | |
""" | |
| **@author:** Prathyush SP | |
| Logging Setup |
A list of useful commands for the FFmpeg command line tool.
Download FFmpeg: https://www.ffmpeg.org/download.html
Full documentation: https://www.ffmpeg.org/ffmpeg.html