Skip to content

Instantly share code, notes, and snippets.

View iamkeyur's full-sized avatar
🏠
Working from home

Keyur iamkeyur

🏠
Working from home
View GitHub Profile
@iamkeyur
iamkeyur / array.py
Created October 26, 2021 15:29
Manim Array
%%manim -v WARNING -qm SquareToCircle
class ArrayIndex(VGroup):
"""
Visualization of an array index.
Includes a highlighting rectangle for the array element, and option pointer and label
with index value.
"""
@iamkeyur
iamkeyur / list.txt
Last active May 21, 2021 14:37
Linux Logging Functions
AA_BUG
AA_DEBUG
AA_ERROR
AA_WARN
ABANDON
ABIT_UGURU3_DEBUG
ABIT_UGURU_DEBUG
ABRT_PRINTK
ac97_dbg
ac97_err
@iamkeyur
iamkeyur / aid.md
Last active October 1, 2020 20:44
[Financial Aid]

My name is Keyur and I am from India . As a student, I do not have any special source of income, but things get even worse when you are a student. I live only on my scholarship ($1000 per annum). I can't pay for this course. Financial Aid will help me take this course without any adverse impact on my monthly essential needs. I want to take this course as I want to complete the Algorithm Specialization on Coursera. I can barely feed myself and pay for a dorm with the money I have. For me, it seems impossible to pay for an entire course by myself. My parents can't help me, either. So, I would say that the main reason I 'm asking you for the Financial Aid is the circumstances due to which I happened to born in a lovely country – India. Receiving this Financial Aid will open for me new horizons of the world of Coursera courses, which in turn will help me in future. I wanted to take this specialization but couldn't afford it; hence, I decided to apply for Financial Aid. The financial Aid will help me take the cour

@iamkeyur
iamkeyur / key.md
Created August 7, 2020 15:43
[Checking if a key exists in a JavaScript object?] #key #object

Checking for undefined-ness is not an accurate way of testing whether a key exists. What if the key exists but the value is actually undefined?

var obj = { key: undefined };
obj["key"] !== undefined // false, but the key exists!

You should instead use the in operator:

"key" in obj // true, regardless of the actual value

If you want to check if a key doesn't exist, remember to use parenthesis:

@iamkeyur
iamkeyur / chunks.md
Last active August 7, 2020 15:37
[Array into chunks] Divide an array in multiple chunks of specified size #array #javascript

The array.slice method can extract a slice from the beginning, middle, or end of an array for whatever purposes you require, without changing the original array.

var i,j,temparray,chunk = 10;
for (i=0,j=array.length; i<j; i+=chunk) {
    temparray = array.slice(i,i+chunk);
    // do whatever
}
@iamkeyur
iamkeyur / latency.md
Created November 14, 2019 16:52
latency-numbers

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns

Branch mispredict ............................ 5 ns

L2 cache reference ........................... 7 ns

Mutex lock/unlock ........................... 25 ns
@iamkeyur
iamkeyur / static.py
Created June 23, 2016 04:48
Static Site Generator
import jinja2
import sys
import markdown
import os
import datetime
import shutil
import argparse
import collections
from copy import copy