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
""" | |
Sample script to use ThreadPoolExecutor in a way that is easy to interrupt. | |
""" | |
import concurrent.futures | |
import threading | |
from tqdm import tqdm | |
# A flag indicating whether jobs should be cancelled. | |
cancel_jobs = threading.Event() |
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 rclpy | |
from rclpy.node import Node | |
from sensor_msgs.msg import Image | |
from cv_bridge import CvBridge | |
import cv2 | |
import numpy as np | |
import torch | |
from transformers import AutoImageProcessor, AutoModelForDepthEstimation |
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
### This script wraps all executables in the anaconda bin folder so that they can be used without adding Anaconda | |
### to the path which would break some functionality of ROS (Robot Operating System) | |
### | |
### The commands e.g. jupyter notebook will cause the script to add anaconda to the path, start jupyter notebook | |
### and after jupyter notebook terminated remove anaconda from the path again | |
### | |
### Notable commands: | |
### * release-the-snake Adds conda to the path and removes all aliases defined by this script | |
### Conda will stay in the PATH until the end of the session (terminal is closed) or | |
### until "cage-the-snake" is called |
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 numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn import datasets | |
from matplotlib.patches import Ellipse | |
from math import sqrt | |
def build_dataset(n_samples, n_features, n_classes = 1): | |
''' | |
Create a dataset. |
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 gym | |
import tensorflow as tf | |
from baselines.ppo2 import policies | |
from baselines.common import set_global_seeds, tf_util as U | |
env = gym.make("Reacher-v2") | |
def policy_fn(s, ob_space, ac_space): | |
return policies.MlpPolicy(s, ob_space=ob_space, ac_space=ac_space, nbatch=1, nsteps=1) |
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 Simple LaTeX Example | |
% Author: Richard C Kelley | |
% This is a comment. A comment begins with a '%' and extends to the | |
% end of the line. | |
% We always start our LaTeX documents by specifying the document class | |
% we want to use. There are several document classes available that | |
% you could use if you wanted - article, book, report, letter, | |
% etc. For many purposes, though, all you need is the article |
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
#include "PicoSHA2/picosha2.h" | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <stdlib.h> | |
struct person { | |
std::string name; |
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
#lang racket | |
(define (sum-to n term) | |
(letrec ((S (lambda (acc k) | |
(cond | |
[(eq? k 0) (+ (term 0) acc)] | |
[else (S (+ acc (term k)) (- k 1))])))) | |
(S 0.0 n))) | |
(define vs '()) |
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
cmake_minimum_required(VERSION 3.1) | |
project(dw_wrapper) | |
set (CMAKE_CXX_STANDARD 11) | |
# FindDriveworks.cmake, ArchConfiguration.cmake, and LibFindMacros.cmake were needed for my setup they are taken from driveworks/samples/cmake/ | |
# ArchConfiguration.cmake was the only file that needed small changes, remove the fatal error on line 17 and add the following lines in its place | |
# set(VIBRANTE TRUE) | |
# add_definitions(-DVIBRANTE) | |
# this is the path I placed the driveworks cmake files in |
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 numpy as np | |
import torch | |
import torch.nn as nn | |
from torch.autograd import Variable | |
import torch.nn.functional as F | |
import torch.optim as optim | |
class XorNet(nn.Module): | |
def __init__(self): | |
super().__init__() |
NewerOlder