Skip to content

Instantly share code, notes, and snippets.

View mik30s's full-sized avatar
😐
500 lines of template errors

Michael mik30s

😐
500 lines of template errors
View GitHub Profile
@mik30s
mik30s / log_manager.hpp
Last active July 10, 2019 02:28
A simple and hacky logger using fmtlib in C++17
#pragma once
#include <variant>
// use fmtlib as the backbone for printing and formating messages.
#include <fmt/fmt.h>
// Colors from @gon1332
// https://github.com/gon1332/fort320
/* FOREGROUND */
#define RST "\x1B[0m"
@mik30s
mik30s / knn.js.html
Last active June 8, 2018 02:13
K Nearest Neighbors in Javascript
<div id="knn-react-app" class="embedded-app" style="text-align: center;">
<button id="knn-1-predict-btn"> <i class=""></i> Predict</button>
<input type="checkbox" id="knn-1-scale-btn" />
<label for="subscribeNews">Scale?</label>
<input id="knn-1-kvalue" placeholder="# of neighbours eg. 3"/>
<input id="knn-1-point-input" placeholder="weight,color,seeds eg. 371,3,1" />
<i class="fas fa-equals"></i>
<img width="25" height="25" id="knn-1-class-img" />
</div>
<div id="knn-vis1" style="width: 100%; height: 520px;"></div>
@mik30s
mik30s / 2rr_foward_kinematics.ipynb
Last active May 20, 2018 01:37
Foward kinematics of a RR planar manipulator
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mik30s
mik30s / arduino_serial.c
Created May 22, 2018 00:08
Serial Communication with C++
/*
* Arduino-serial
* --------------
*
* A simple command-line example program showing how a computer can
* communicate with an Arduino board. Works on any POSIX system (Mac/Unix/PC)
*
*
* Compile with something like:
* gcc -o arduino-serial arduino-serial.c
#include <SCServo.h>
SMSCL sm;
SMSCL smB;
long int wait = 5000;
int center = 4095/2;
int speed = 250;
char data[5];
int start = 0;

Second Arm

Part # Servo id Home/Center min max Decreasing direction
Base 1 1750 1000 4095 in to out
Shoulder 2 2250 1500 3000 left to right
Elbow 3 2850 900 3500 down up
Wrist 4 2000 1000 3000 in out

First Arm

#include <stdio.h>
#include <stdlib.h>
#include "ros/ros.h"
#include "std_msgs/MultiArrayLayout.h"
#include "std_msgs/MultiArrayDimension.h"
#include "std_msgs/Int32MultiArray.h"
@mik30s
mik30s / lab1b.py
Created September 5, 2018 04:31
Lab 1 part b - vectors
GlowScript 2.7 VPython
baseball = sphere (pos=vector(0,0,0), radius=0.2, color=color.white)
A = arrow(pos=vector(3,-2,4), axis=vector(1,-4,2), shaftsize = 0.1, color=color.cyan)
B = arrow(pos=vector(-5,3,4), axis=vector(-7,1,2), shaftsize = 0.1, color=color.cyan)
C `= arrow(pos=vector(-1,-6,2), axis=vector(-3,-8,0), shaftsize = 0.1, color=color.cyan)
print("Magnitude of A = ", sqrt(A.pos.x**2 + A.pos.y**2 + A.pos.z**2))
print("A - 3B + 2C = ", A.pos - 3*B.pos + 2*C.pos)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.