Skip to content

Instantly share code, notes, and snippets.

View Quantalabs's full-sized avatar

Arvind Venkatesh Quantalabs

View GitHub Profile
@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 / 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);
@fnky
fnky / ANSI.md
Last active July 21, 2024 20:46
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@kauffmanes
kauffmanes / install_anaconda.md
Last active July 18, 2024 21:15
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li
@XVilka
XVilka / TrueColour.md
Last active July 9, 2024 23:28
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@dsamarin
dsamarin / Complex.js
Created October 3, 2011 03:11
Complex numbers in JavaScript
var Complex = function(real, imag) {
if (!(this instanceof Complex)) {
return new Complex (real, imag);
}
if (typeof real === "string" && imag == null) {
return Complex.parse (real);
}
this.real = Number(real) || 0;