Skip to content

Instantly share code, notes, and snippets.

View jhschwartz's full-sized avatar

Jacob Schwartz jhschwartz

View GitHub Profile
@jhschwartz
jhschwartz / e_filter.py
Last active July 2, 2019 16:40
A local average filter to replace extraneous values in a dataset.
import numpy as np
# [1,2,3,5,6,7,9,101,102,500] --> [[1,2,3],[6,7],[9],[101,102],[500]]
# assumes sorted
def consecs(nums):
def np_pop_front(array):
last, array = array[0], array[1:]
return last, array
cons_outer = []
cons_inner = []
@jhschwartz
jhschwartz / socket.js
Last active May 5, 2019 16:38
Example Socket for Emotiv EPOC+ Wireless EEG (emotiv.com/epoc)
// Written by Jacob Schwartz, [email protected], September 2018, edited & published May 2019
// In September 2018, I worked with the EPOC+ as part of a project for the MedHacks Hackathon.
// It was extremely counterintuitive to work with, and if anyone else comes across issues with
// it I figure this code might be helpful. It was awhile ago but I'd be willing to try to to help
// if anyone experiences issues with the device - just open an issue on my project's repo
// (github.com/jhschwartz/medhacks-zzg) and I'll see if I can help.
// EMOTIV docs: https://emotiv.github.io/cortex-docs/
// see https://github.com/jhschwartz/medhacks-zzg for my failed project that used the EPOC+
@jhschwartz
jhschwartz / RingBuffer.cpp
Last active December 7, 2024 23:31
My simple circular buffer in C++
//
// RingBuffer.cpp
//
// Created by Jacob Schwartz on 10/23/17.
//
#include "RingBuffer.hpp"
#include <cassert>
RingBuffer::RingBuffer() {}
@jhschwartz
jhschwartz / inheritance_example.py
Last active August 20, 2017 09:09
An example of inheritance in python from an abstract class
#! /usr/bin/python
from abc import ABCMeta, abstractmethod
class abstractstaticmethod(staticmethod):
# https://stackoverflow.com/questions/4474395/staticmethod-and-abc-abstractmethod-will-it-blend
__slots__ = ()
def __init__(self, function):
super(abstractstaticmethod, self).__init__(function)