Skip to content

Instantly share code, notes, and snippets.

View Quantalabs's full-sized avatar

Arvind Venkatesh Quantalabs

View GitHub Profile
@Quantalabs
Quantalabs / Differential-Privacy-Algorithm.js
Last active June 22, 2021 20:52
Simple differential privacy algorithm
var flip = function (dataArray) {
var a = dataArray;
for(var i = 0; i < a.length; i++) {
var b = Math.random(0,1);
var c = Math.round(b);
if(c === 0) {
a[i] = true;
}
if(c === 1) {
var b1 = Math.random(0,1);
@Quantalabs
Quantalabs / Padovan Sequence Calc.js
Last active May 25, 2020 20:18
Outputs numbers in the Padovan Sequence. Modify the variable "amount" to change amount of numbers outputede. Read more on the Pardovan Sequence at https://en.wikipedia.org/wiki/Padovan_sequence
var list = [1,1,1] //changing these values to [3,0,2] will output the perrin sequence
var amount = 7 //changing this value will change the amount of numbers outputed.
for(var i = 0; i < amount-3; i++) { //chaning the number that is subtracted from 'amount' is the original length of list
var j = list[i];
var e = list[i+1];
list.push(j+e)
}
console.log(list) //change to 'document.body.innerHTML = list' to show on webpage or append to a div or paragraph if needed
@Quantalabs
Quantalabs / Fibbonacci Sequence.js
Created May 25, 2020 20:50
Outputs a number in the fibbonacci sequence in the console. Read about the fibbonacci sequence at https://en.wikipedia.org/wiki/Fibonacci_number
var calc = function (amount) {
var a = 1 //change the two variables to get a different fibbonacci sequence
var b = 1
for(var i = 0; i < amount; i++) {
var i = a+b
b = a
a = i
}
console.log(a) //outputs the 'amount' number in the fibbonacci sequence.
}
@Quantalabs
Quantalabs / lights.html
Created September 26, 2020 22:17
Creates random light looking patterns.
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Design</title>
<style>
body{
margin: 0px;
background-color: black;
overflow-y: hidden;
@Quantalabs
Quantalabs / data.py
Created November 2, 2020 03:16
Sample data for one of my medium articles
data = [0,1,1,0,1,1,1,0,1,1,0,1,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1]
@Quantalabs
Quantalabs / sir-model.js
Last active June 11, 2021 17:40
Basic SIR Model in JS
function sir (rn, s, i, time, u, p) {
data = {
S: [s],
I: [i],
R: [p-(s+i)]
}
b = rn*u
@Quantalabs
Quantalabs / Useful-utils.sh
Last active July 28, 2021 20:04
Useful utilities to install for your linux distribution.
echo "Installing git..."
sudo apt install git-all
echo "Completed!"
echo "Installing ZSH..."
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo "Configuring..."
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
echo "Completed"
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"