Skip to content

Instantly share code, notes, and snippets.

View arvind-iyer's full-sized avatar
⚖️
Listen to what you know instead of what you fear

Arvind Iyer arvind-iyer

⚖️
Listen to what you know instead of what you fear
View GitHub Profile
<canvas id="canvas" width="640" height="360"></canvas>
<div class="test">
</div>
import numpy as np
def nonlin(x, deriv=False):
if(deriv==True):
return x * (1-x)
return 1/(1+np.exp(-x))
#input data
X = np.array([ [0,0,1],
[0,1,1],
@arvind-iyer
arvind-iyer / Kata.hs
Last active June 22, 2016 15:34
Find the last digit on sequentially exponentiating a list of Integer values from left to right. E.g. [3,4,5] => (3 ^ ( 4 ^ 5 )) mod 10
module Kata
(
lastDigitOnExp
,lastDigitListReduce
) where
lookupTable = [ [0,0,0,0],
[1,1,1,1],
[2,4,8,6],
[3,9,7,1],
[4,6,4,6],
// MPU-6050 Accelerometer + Gyro
// -----------------------------
//
// By arduino.cc user "Krodal".
// June 2012
// Open Source / Public Domain
//
// Using Arduino 1.0.1
// It will not work with an older version,
@arvind-iyer
arvind-iyer / prezto.sh
Created September 28, 2016 14:35
Install prezto on ubuntu
#!/bin/bash
prezto.sh(){
clear
sudo apt-get install -y git
sudo apt-get update && sudo apt-get install -y zsh
# Get prezto
git clone --recursive https://github.com/sorin-ionescu/prezto.git ~/.zprezto
# Backup zsh config if it exists
@arvind-iyer
arvind-iyer / .vimrc
Last active September 27, 2018 05:40
set nocompatible
filetype off
syntax on
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'nvie/vim-flake8'
-- Hello!!
-- Making Music in Haskell (feat. TidalCycles)
-- By Arvind Iyer
d1 $ sound "<alphabet:12 alphabet:19 alphabet:18>"
hush
-- Make a drum beat
@arvind-iyer
arvind-iyer / timeutil.py
Created November 7, 2019 05:08
Benchmark function
# Function decorator to save system CPU and memory consumption
# as well as execution duration of the function supplied
import time
import psutil
def timeit(report):
"""
Use as decorator for a function, provide a dictionary object as parameter
"""
@arvind-iyer
arvind-iyer / streamclient.html
Last active May 15, 2020 05:04
Async video stream relay with opencv + websockets
<html>
<head>
<title>Websocket video stream client example</title>
</head>
<body>
<canvas id="canvas" width="640" height="480"></canvas>
<script>
var websocketAddress = "ws://localhost:8765/media/zurich";
var c = document.getElementById("canvas");
@arvind-iyer
arvind-iyer / caustic.js
Created November 8, 2022 16:18
A-Frame Shaders
AFRAME.registerShader('caustic', {
schema: {
time: {type: 'time', is: 'uniform'},
color: {type: 'color', is: 'uniform', default: '#2647fc'},
base: {type: 'map', is: 'uniform'},
obj: {type: 'map', is: 'uniform'},
uvScale: {type: 'vec2', is:'uniform', default: {x: 0.3, y: 0.3}},
brightness: {type: 'number', is: 'uniform', default: 22.0},
speed: {type: 'number', is: 'uniform', default: 0.02}
},