Skip to content

Instantly share code, notes, and snippets.

View ToniRV's full-sized avatar
🎯
Focusing

Antoni Rosinol ToniRV

🎯
Focusing
View GitHub Profile
@jlblancoc
jlblancoc / gtsam-serialization-example.cpp
Created October 6, 2020 06:50
GTSAM factor graph serialization example
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <fstream>
#include <gtsam/base/serialization.h>
// ... Includes for your values and factors:
#include <gtsam/base/GenericValue.h> // GTSAM_VALUE_EXPORT
#include <gtsam/geometry/Pose2.h>
@ToniRV
ToniRV / cbuild.py
Last active May 7, 2022 13:02
Makes the annoying 'mkdir build, cd build, cmake .., make -j $(nproc)' in one call in the root directory as 'cbuild'. It also accepts the arg `--clean` which calls `make clean` before `make`. Simplest way to have it as a command line function is to add it to your .bashrc as an alias like: `alias cbuild="${HOME}/path/to/cbuild.py"`
#!/usr/bin/env python
import signal
import sys
import os
import subprocess
import argparse
# Group of Different functions for different styles
if sys.platform.lower() == "win32":
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward