Skip to content

Instantly share code, notes, and snippets.

View arjo129's full-sized avatar
💭
🦀

Arjo Chakravarty arjo129

💭
🦀
View GitHub Profile
@arjo129
arjo129 / hpfilter.c
Created August 7, 2012 01:36
High pass and low pass filters in c specifically for the Arduino
// Freq is not the frequency in hertz but the time constant RC
int lowpass(int portinput, int freq, int samplerate, int prev){
int RC = samplerate/(samplerate+freq);
int returnd = RC*portinput+(1-RC)*prev;
return returnd;
}
int highpass(int portinput, int freq, int samplerate, int prevport, int prevproc){
int RC = samplerate/(samplerate+freq);
int returnd = RC*(prevproc+portinput-prevproc);
return returnd;
@arjo129
arjo129 / Partition function results
Created July 28, 2013 08:44
This is the series for partition function
[1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231, 297, 385, 490, 627, 792, 1002, 1255, 1575, 1958, 2436, 3010, 3718, 4565, 5604, 6842, 8349, 10143, 12310, 14883, 17977, 21637, 26015, 31185, 37338, 44583, 53174, 63261, 75175, 89134, 105558, 124754, 147273, 173525, 204226, 239943, 281589, 329931, 386155, 451276, 526823, 614154, 715220, 831820, 966467, 1121505, 1300156, 1505499, 1741630, 2012558, 2323520, 2679689, 3087735, 3554345, 4087968, 4697205, 5392783, 6185689, 7089500, 8118264, 9289091, 10619863, 12132164, 13848650, 15796476, 18004327, 20506255, 23338469, 26543660, 30167357, 34262962, 38887673, 44108109, 49995925, 56634173, 64112359, 72533807, 82010177, 92669720, 104651419, 118114304, 133230930, 150198136, 169229875, 190569292, 214481126, 241265379, 271248950, 304801365, 342325709, 384276336, 431149389, 483502844, 541946240, 607163746, 679903203, 761002156, 851376628, 952050665, 1064144451, 1188908248, 1327710076L, 1482074143L, 1653668665L, 1844349560L, 2056148051L, 2291320912L, 2552338241L,
@arjo129
arjo129 / roverbase.ino
Last active December 29, 2015 01:49
For SSIS Robotics Club
int pwm_a = 3; //PWM control for motor outputs 1 and 2 is on digital pin 3
int pwm_b = 11; //PWM control for motor outputs 3 and 4 is on digital pin 11
int dir_a = 12; //direction control for motor outputs 1 and 2 is on digital pin 12
int dir_b = 13; //direction control for motor outputs 3 and 4 is on digital pin 13
int val = 0;
void setup(){
pinMode(pwm_a, OUTPUT);
pinMode(pwm_b, OUTPUT);
pinMode(dir_b, OUTPUT);
pinMode(dir_a, OUTPUT);
@arjo129
arjo129 / 2048.c
Last active August 29, 2015 13:58 — forked from justecorruptio/2048.c
A more readable version
M[16],X=16,W,k;
main(){
T(system("stty cbreak"));
puts(W&1?"WIN":"LOSE");
}
K[]={2,3,1};
s(f,d,i,j,l,P){
for(i=4;i--;){
for(j=k=l=0;k<4;){
@arjo129
arjo129 / debugUspeech
Created April 30, 2014 03:08
debug uspeech file from 4.1.1
#include <uspeech.h>
signal voice(A0);
char option = 0;
void setup(){
voice.calibrate();
voice.f_enabled = true;
Serial.begin(9600);
}
void loop(){
//voice.sample();
------------------------------- MODULE hanoi -------------------------------
EXTENDS Integers, Sequences
\* Towers of hanoi problem
VARIABLES tower1, tower2, tower3
\* Initiallize the towers
Init == /\ tower1 = <<3,2,1,0>>
/\ tower2 = <<0>>
/\ tower3 = <<0>>
\* Transition rules
@arjo129
arjo129 / conjugation.py
Created December 10, 2017 10:55
Just the conjugation... It doesnt work correctly still
def conjugation(self, vector):
"""Conjugation of vector by self.
@param self unit quaternion.
@param vector 3-vector, aka pure quaternion.
@return pure quaternion of result: self *vector*self.
"""
self.x,self.y,self.z = self.v
Q = np.array([[self.w, -self.z, self.y, self.x],
[ self.z, self.w, -self.x, self.y],
[-self.y, self.x, self.w, self.z],
import rospy
from sensor_msgs.msg import *
from cv_bridge import CvBridge
import cv2
import numpy as np
bridge = CvBridge()
rospy.init_node("Redmasker")
image_pub = rospy.Publisher("RedMasked",Image)
def img_handler(msg):
@arjo129
arjo129 / mamama
Last active April 1, 2018 10:41
A very important shell utility
#!/bin/bash
# This is the most important shell utility... remember to place it in your PATH
# chmod +x mamama
echo "Ototototo"
@arjo129
arjo129 / chat.msg
Last active August 21, 2018 07:15 — forked from chewwt/chat.msg
std_msgs/Header header
std_msgs/String source_id
std_msgs/String message