Skip to content

Instantly share code, notes, and snippets.

View collinalexbell's full-sized avatar

collinalexbell collinalexbell

  • 19:20 (UTC -04:00)
View GitHub Profile
(ns daemon.visual-cortex.pushup-counter
(:require
[daemon.smart-atom :as smart-atom]
[daemon.voice.core :as voice]
[clojure.math.numeric-tower :as math])
(:import org.httpkit.BytesInputStream
[org.opencv.core MatOfByte Core Mat Point Scalar]
[org.opencv.imgcodecs Imgcodecs]
[org.opencv.imgproc Imgproc]
[org.opencv.video Video])
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
FILE * fifo;
char BUFF[500];
struct a_header{
@collinalexbell
collinalexbell / repl
Created November 12, 2016 19:52
Regarding multi-dim indexing of numpy arrays
>>> a = np.array([[1,2,3],[4,5,6]])
>>> a
array([[1, 2, 3],
[4, 5, 6]])
>>> b = [1,2]
>>> a[:, b]
array([[2, 3],
[5, 6]])
>>> a[np.arange(len(a)), b]
array([2, 6])
(defmacro infix [a b c]
`(~b ~a ~c))
(defmacro python-fn-call [f a]
(if (not (nil? a))
(cons f a)
f))
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev
sudo apt-get install -y libopencv-dev
(defun box-muler-sample ()
(* (sqrt (* -2 (log (random 1.0)))) (cos (* 2 pi (random 1.0)))))
(defun simulate-height-expiriement ()
(let ((count 0)
(max -9999))
(dotimes (i 1000)
(let ((new-sample (box-muler-sample)))
(if (> new-sample max)
(progn
@collinalexbell
collinalexbell / structure_move.py
Last active August 6, 2017 01:41
structure_move.py
import serial
import time
ser = serial.Serial("/dev/ttyACM0")
time.sleep(2)
def write_pos(z,y):
ser.write(0)
ser.write(y)
ser.write(1)
#include <Servo.h>
Servo y_rotate_servo;
Servo z_rotate_servo;
int toggle_motor_pin = 12;
unsigned long last_command_time = 0;
(ns torque-sim.core)
;;I want to calculate the strenght of motors needed for a robot of various parameters
(defn get-motor-strength
[robot-femur-length robot-torso-weight]
()
)
(def g 9.8)
@collinalexbell
collinalexbell / basic_flask_server.py
Last active October 19, 2017 12:41
A flask server used to inject javascript into a window to test using PhantomJS
import threading
from yattag import Doc
from flask import Flask
js_scripts = []
app = (Flask(__name__))
thread = None
def start(host='0.0.0.0', port = 6969):
"""Gets app listening on host:port. Call inject before starting the