Skip to content

Instantly share code, notes, and snippets.

@rebeccali
rebeccali / pokemon.csv
Created June 7, 2021 14:38
csvexample
Name Total HP Attack Defence Sp_attack Sp_defence Speed
Bulbasaur 318 45 49 49 65 65 45
Ivysaur 405 60 62 63 80 80 60
Venusaur 525 80 82 83 100 100 80
Mega Venusaur 625 80 100 123 122 120 80
Charmander 309 39 52 43 60 50 65
Charmeleon 405 58 64 58 80 65 80
Charizard 534 78 84 78 109 85 100
Mega Charizard 634 78 130 111 130 85 100
Mega Charizard X 634 78 104 78 159 115 100
@rebeccali
rebeccali / check.py
Created November 30, 2020 20:46
Check CUDA with Tensorflow
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

How to get linux to let me flash Sparkfun Pro Micro

In trying to get Redox Wireless flashed, you have to upload the firmware to your arduino pro micro with QMK firmware.

  1. Plug in the micro to your computer, check that it is actually connected with a datacable by running ls /dev/tty* and seeing a new device appear.
  2. Run make redox_W:default:avrdude
  3. Quickly reset the pro micro by shorting GND and RST twice quickly
  4. When it says waiting for /dev/whatever to be writable, in another terminal run sudo chmod 666 /dev/whatever so you have permission to write
  5. it should flash now haha
  6. You might have to add your user to the dialout group. Not sure if that mattered.
# Add some executable to the dmenu. Basically just adds a symlink so PATH can see it.
ln -s /path/to/my/script /usr/bin/
class DoubleDeepQNetwork(nn.Module):
def __init__(self, xdim, udim, hdim=16):
super().__init__()
if torch.cuda.is_available() == True:
self.dtype_double = torch.cuda.FloatTensor
self.dtype_int = torch.cuda.LongTensor
else:
raise Exception('NO CUDA')
self.dtype_double = torch.FloatTensor
self.dtype_int = torch.LongTensor
class DoubleDeepQNetwork(nn.Module):
def __init__(self, xdim, udim, hdim=16):
super().__init__()
if torch.cuda.is_available() == True:
self.dtype_double = torch.cuda.FloatTensor
self.dtype_int = torch.cuda.LongTensor
else:
raise Exception('NO CUDA')
self.dtype_double = torch.FloatTensor
self.dtype_int = torch.LongTensor
import datetime
timestamp = datetime.datetime.now().strftime("%d-%m-%Y_%H-%M-%S")
import torch.autograd
import torch.nn as nn
from au_functional import jacobian
import torch
from torchdiffeq import odeint
true_y0 = torch.tensor([[2., 0.]], requires_grad=True)
data_size=5
t = torch.linspace(0., 25., data_size)
true_A = torch.tensor([[-0.1, 2.0], [-2.0, -0.1]])
@rebeccali
rebeccali / rosbag2python.py
Created February 1, 2020 20:53
Turn a ROSBag into Python for manipulation
import rosbag
with rosbag.Bag(bagfile) as bag:
start_time = bag.get_start_time()
topic_name = "/mytopic/ddk"
for (i, (topic, msg, t)) in enumerate(bag.read_messages(topics=[topic_name])):
# Do some stuff with the bag
pose = msg.pose.pose.position
positionx = pose.x
vel = msg.twist.twist.linear
@rebeccali
rebeccali / installing_external_ros_pkgs.md
Created September 21, 2018 19:43
Installing ROS packages from external source

How to install external ROS packages

  1. First, you will need to source your overall ros installation. This enables the basic ROS tools (rospack, rosrun, etc.).
source /opt/ros/kinetic/setup.bash 
  1. Source your catkin workspace. See http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment if you do not know what this is. To my knowledge, this sets a bunch of environment variables.