Skip to content

Instantly share code, notes, and snippets.

View iamsurya's full-sized avatar

Surya Sharma iamsurya

View GitHub Profile
@iamsurya
iamsurya / Bank.c
Created September 22, 2014 20:28
Bank.c
#include <string.h>
#include "bank.h"
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
static int current_balance;
int BalanceFlag = 0; /* 0 for No Activity, 1 for Activity in the last 10 seconds */
pthread_mutex_t BalanceLock, FlagLock;
@iamsurya
iamsurya / sdlog.cfg
Created May 15, 2015 00:02
Shimmer MPL DMP Config
accel=0
gyro=0
mag=0
exg1_24bit=0
exg2_24bit=0
gsr=0
extch7=0
extch6=0
br_amp=0
vbat=1
@iamsurya
iamsurya / QuatCalc.c
Created September 30, 2015 18:20
Calculating Linear Acceleration by subtracting gravity
/* Read quaternions */
float q0 = float.Parse(values[3]);
float q1 = float.Parse(values[4]);
float q2 = float.Parse(values[5]);
float q3 = float.Parse(values[6]);
/* Read Gyro data */
Gx = float.Parse(values[7]);
Gy = float.Parse(values[8]);
Gz = float.Parse(values[9]);
/* Author Sonik Sharma 26/2/2017
Program to ask the user for a number
then print its table from 1 to 10
*/
/* Include files */
#include<iostream> /* includes cout cin */
#include<conio.h> /* conio = console io. includes getch = get character from keyboard */
/* */
/* Author Sonik Sharma 26/2/2017
Program to ask the user for a number
then print its table from 1 to 10
*/
/* Include files */
#include<iostream> /* includes cout cin */
#include<conio.h> /* conio = console io. includes getch = get character from keyboard */
/* */
/* Author Sonik Sharma 26/2/2017
Hello World program
*/
/* Include files */
#include<iostream> /* includes cout cin */
#include<conio.h> /* conio = console io. includes getch = get character from keyboard */
/* My hello world program */
int main()
/*
Raju Pengananapuram is a scientist from Chennai working in ISRO. His next project
is to create an algorithm for India's first Mars rover and has three days to do it.
However he also has to attend his brothers wedding in Trivendrum tomorrow.
He sits in his office worried. As he looks outside his window, he comes up with an idea.
He will ask one of his students, Sonik Sharma to help him with this work.
Your task is to calculate the distance the mars rover will travel given a velocity using
the formula distance = time * speed.
/*
Raju Pengananapuram looks at Sonik's program and finds it very useful.
However he realized that NASA's scientists want time to be between
1 seconds and 21 seconds with 2 second intervals (1, 3, 5... 21)
and the European Space Agency wants time between 30 and 180 seconds
with 30 second intervals (30, 60, 90... 180).
Recreate the program using while loops. Ask Raju for velocity, start time, end time
and interval.
/*
Hello Mr. Raju Pengananapuram, please enter the velocity for MRover: 231.15
Please enter start time = 1
Please enter end time = 21
Please enter increment = 2
Results for distance calculation for MRover:
Time Distance Travelled (metres)
1 231.15
3 693.45
@iamsurya
iamsurya / keras2TF_preamble.py
Last active May 31, 2019 19:20
Keras2TF Example Preamble
# imports
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Load the data
df = pd.read_csv("slope-lownoise.txt", sep='\t', header=None)
labels = np.asarray(df[0]).reshape((len(df[0]),-1))
data = np.asarray(df.iloc[:,1:])