Skip to content

Instantly share code, notes, and snippets.

@oliverlee
oliverlee / plot_n_link_pendulum.py
Created October 19, 2015 14:26
ode integrator method plots
@oliverlee
oliverlee / gist:d9f777211a4269ba7777
Created October 19, 2015 16:11
mass_spring_damper error
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
/Users/oliverlee/repos/sympy/sympy/printing/preview.py in preview(expr, output, viewer, euler, packages, filename, outputbuffer, preamble, dvioptions, outputTexFile, **latex_settings)
200 check_output(['latex', '-halt-on-error', '-interaction=nonstopmode',
--> 201 'texput.tex'], cwd=workdir, stderr=STDOUT)
202 except CalledProcessError as e:
/Users/oliverlee/miniconda3/envs/dev/lib/python3.4/subprocess.py in check_output(timeout, *popenargs, **kwargs)
619 if retcode:
--> 620 raise CalledProcessError(retcode, process.args, output=output)
In [1]: import h5py
In [2]: f = h5py.File('../data/20160107-113037_sensor_data.h5', 'r')
In [3]: def p(x, obj):
...: try:
...: attrs = list(obj.attrs.items())
...: if attrs:
...: print(x, attrs)
...: else:
@oliverlee
oliverlee / simulator_stability.ipynb
Created June 29, 2017 12:10
simulator transfer function analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oliverlee
oliverlee / check_timestamp.ipynb
Last active November 23, 2017 18:58
check_timestamp.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oliverlee
oliverlee / detection.py
Created April 23, 2018 09:28
sample car detection with lidar
from hdbscan import HDBSCAN
from sklearn import metrics
from sklearn.preprocessing import StandardScaler
import numpy as np
import scipy.spatial
import seaborn as sns
xy_lim = ((-60, 60), (0, 60))
n = 12
@oliverlee
oliverlee / detection.py
Created April 23, 2018 09:28
sample car detection with lidar
from hdbscan import HDBSCAN
from sklearn import metrics
from sklearn.preprocessing import StandardScaler
import numpy as np
import scipy.spatial
import seaborn as sns
xy_lim = ((-60, 60), (0, 60))
n = 12
@oliverlee
oliverlee / winter.py
Last active April 30, 2018 12:24
Winter split question
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def solution(T):
winter, summer = winter_split(T)
#print('winter', winter)
#print('summer', summer)
#assert set(winter).isdisjoint(set(summer))
return len(winter)
@oliverlee
oliverlee / player.rs
Created May 31, 2019 22:25
player.rs
extern crate rand;
use crate::dominion::CardKind;
use rand::thread_rng;
use rand::seq::SliceRandom;
type CardVec = Vec<&'static CardKind>;
#[derive(Debug)]
pub struct Player {
@oliverlee
oliverlee / main.cc
Created October 14, 2019 18:11
placement new
#include <iostream>
#include <vector>
struct C {
C(int a, int b) : a_{a}, b_{b} { std::cout << "ctor" << std::endl; }
~C() { std::cout << "dtor" << std::endl; }
int a_;
int b_;
} __attribute__((packed));