Skip to content

Instantly share code, notes, and snippets.

@rkrishnasanka
rkrishnasanka / EC521_GraderTool.py
Last active August 29, 2015 14:06
Prints out corrects , partials and wrongs from the detail string
def parseDetail(line):
corrects = 0
wrongs = 0
partials = 0
for i in range(0,len(line)):
c = line[i]
if c=='+': corrects=corrects+1
if c=='-': wrongs=wrongs+1
%panthgompkins with heart beat detection
% [email protected]
clc;
clear all
close all
x1 = load('ecg3.dat');
y=length(x1);
fs = 200;
N = length (x1);
t = [0:N-1]/fs;
#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"
#define MY_UUID { 0x39, 0x20, 0xBF, 0x15, 0xE4, 0xDA, 0x4E, 0x77, 0x9C, 0xDB, 0x3E, 0xD1, 0xCB, 0x6F, 0x28, 0xFB }
PBL_APP_INFO(MY_UUID,
"Hello World App", "ElctronicsMadeEasy",
1, 0, /* App version */
DEFAULT_MENU_ICON,
APP_INFO_STANDARD_APP);
/******************************************************************************
*
* Function Name: manualCopy
*
* Description: Manually copies data from memory to memory. This is used by
* sysFastMemCopy to copy a few lingering bytes at the beginning and end.
*
*****************************************************************************/
inline void manualCopy( uint8 *pDest, uint8 *pSrc, uint32 len )
@rkrishnasanka
rkrishnasanka / numpytest.py
Last active October 24, 2018 13:58
Numpy Cheat sheet
import numpy as np
def run():
# create a column vector
col_vec = np.array([[1], [2]])
print "column vector"
print col_vec
# create a row vector
row_vec = np.array([[1, 2]])
Walter Bright's MEM Package
---------------------------
PREFACE:
--------
The files, MEM.H and MEM.C which constitute the MEM package were originally
published in the March-April 1990 edition of Micro Cornucopia magazine, now
sadly out of print. The files as they appear in SNIPPETS have been edited
@rkrishnasanka
rkrishnasanka / CRC.c
Created May 9, 2014 09:27
CRC Implementation for the Reaction Wheels
#define POLY 0x8408 /* bits reversed for LSB-first */
unsigned short crc = 0xffff;
while (len-- > 0) {
unsigned char ch = *bufp++;
for (i = 0; i < 8; i++) {
crc = (crc >> 1) ˆ ( ((ch ˆ crc) & 0x01) ? POLY : 0 );
ch >>= 1;
}
}
# Written by Raul Aguaviva as an exercise
# beware not optimized for speed :-)
from struct import *
import math
zigzag = [0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
@rkrishnasanka
rkrishnasanka / revenge.py
Last active August 29, 2015 13:57
Email Bomber Script for taking revenge on friends
import urllib
import smtplib
import time
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from random import randint
def sendemail(session,me,you,subject,html):
# Create message container - the correct MIME type is multipart/alternative.
@rkrishnasanka
rkrishnasanka / PYNN.py
Created March 14, 2014 08:07
Python Neural Network with back propagator
# Back-Propagation Neural Networks
#
# Written in Python. See http://www.python.org/
# Placed in the public domain.
# Neil Schemenauer <[email protected]>
import math
import random
import string