Skip to content

Instantly share code, notes, and snippets.

View thangarajan8's full-sized avatar
💭
Learning to How to Learn

itsthanga thangarajan8

💭
Learning to How to Learn
View GitHub Profile
cacheSolve <- function(x, ...) {
s <- x$getsolve()
if(!is.null(s)) {
message("getting cached data")
return(s)
}
data <- x$get()
s <- solve(data, ...)
x$setsolve(s)
s
makeCacheMatrix <- function(x = numeric()) {
s <- NULL
set <- function(y) {
x <<- y
s <<- NULL
}
get <- function() x
setsolve <- function(solve) s <<- solve
getsolve <- function() s
list(set = set, get = get,
@thangarajan8
thangarajan8 / clk.tsv
Created May 24, 2016 10:49 — forked from ceteri/clk.tsv
Intro to Apache Spark: code example for (K,V), join, operator graph
2014-03-04 15dfb8e6cc4111e3a5bb600308919594 11
2014-03-06 81da510acc4111e387f3600308919594 61

Windows System Metrics

Processes

  • system.proc.queue_length: The process queue length.
  • system.proc.count: The count of running processes.

Memory

@thangarajan8
thangarajan8 / import_csv_to_mongo
Created July 3, 2017 08:08 — forked from mprajwala/import_csv_to_mongo
Store CSV data into mongodb using python pandas
#!/usr/bin/env python
import sys
import pandas as pd
import pymongo
import json
def import_content(filepath):
mng_client = pymongo.MongoClient('localhost', 27017)
@thangarajan8
thangarajan8 / mongodb_2_pandas.py
Created July 3, 2017 08:20 — forked from jmquintana79/mongodb_2_pandas.py
Functions to connect and read mongodb data to pandas df
import pandas as pd
from pymongo import MongoClient
# set connection with mongodb
def _connect_mongo(host, port, username, password, db):
""" A util for making a connection to mongo """
if username and password:
mongo_uri = 'mongodb://%s:%s@%s:%s/%s' % (username, password, host, port, db)
conn = MongoClient(mongo_uri)
@thangarajan8
thangarajan8 / index.html
Created July 19, 2017 11:55
LineChart created by thangarajan8 - https://repl.it/J84m/7
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script src="index.js"></script>
@thangarajan8
thangarajan8 / getAllValuesByKey.js
Created July 19, 2017 11:56
getAllValuesByKey created by thangarajan8 - https://repl.it/J8WP/5
var users = [{name: 'rajan', age: 35, favfood: 'icecream'},
{name: 'king', age: 25, favfood: 'bear'},
{name:"thanga", age:27, favfood :"briyani"}];
console.log(users);
console.log(users[0].name);
function getAllValuesByKey(users,keyName){
@thangarajan8
thangarajan8 / latency.txt
Created January 23, 2020 12:44 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
{"key_0": "key_0", "key_1": "key_1", "key_2": "key_2", "key_3": "key_3", "key_4": "key_4", "key_5": "key_5", "key_6": "key_6", "key_7": "key_7", "key_8": "key_8", "key_9": "key_9", "key_10": "key_10", "key_11": "key_11", "key_12": "key_12", "key_13": "key_13", "key_14": "key_14", "key_15": "key_15", "key_16": "key_16", "key_17": "key_17", "key_18": "key_18", "key_19": "key_19", "key_20": "key_20", "key_21": "key_21", "key_22": "key_22", "key_23": "key_23", "key_24": "key_24", "key_25": "key_25", "key_26": "key_26", "key_27": "key_27", "key_28": "key_28", "key_29": "key_29", "key_30": "key_30", "key_31": "key_31", "key_32": "key_32", "key_33": "key_33", "key_34": "key_34", "key_35": "key_35", "key_36": "key_36", "key_37": "key_37", "key_38": "key_38", "key_39": "key_39", "key_40": "key_40", "key_41": "key_41", "key_42": "key_42", "key_43": "key_43", "key_44": "key_44", "key_45": "key_45", "key_46": "key_46", "key_47": "key_47", "key_48": "key_48", "key_49": "key_49", "key_50": "key_50", "key_51": "key_51", "ke