Skip to content

Instantly share code, notes, and snippets.

View karthikeyann's full-sized avatar

Karthikeyan karthikeyann

View GitHub Profile
@karthikeyann
karthikeyann / get_all_bhavcopy_of_year.sh
Created January 31, 2019 20:16
EOD EQUITIES data from NSE website (get all bhavcopy files of the year)
#!bash
YEAR=2018
for MONTH in JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
do
for d in {1..31}
do
foo=$(printf "%02d" $d)
curl -O "https://www.nseindia.com/content/historical/EQUITIES/${YEAR}/${MONTH}/cm${foo}${MONTH}${YEAR}bhav.csv.zip"
done
done
@karthikeyann
karthikeyann / measure_time_memory.py
Created June 27, 2018 17:16
Measures Time taken and Memory before and after for a block of Python code
import time
import os
import psutil
class MeasureMemTime:
def __init__(self):
self.start = None
self.end = None
@karthikeyann
karthikeyann / PDFJS_disableRange
Last active August 29, 2015 14:04
PDFJS sometimes does not load pdf becuase range requests are disable in proxy servers. This greasemonkey script automatically reloads the page disabling range using hashparams in url.
// ==UserScript==
// @name Firefox PDFJS
// @namespace poulet
// @include /^(http|https|file)://.*.pdf$/
// @version 1
// @grant none
// ==/UserScript==
// NOTE: Reloads the PDF by disabling Range requests for some proxies.
// NOTE: Useful for Firefox PDFJS viewer for proxies without range requests (ex: proxy inside IIT Madras)
var url=window.location
@karthikeyann
karthikeyann / Verilog_constMultiplier.py
Created March 9, 2014 11:44
Generates verilog code for fractional constant multiplier
#!/usr/bin/python
# Author: Karthikeyan
# https://github.com/lxkarthi
# Description: Generates Verilog code for fractional constant multiplier
## Functions defined
##############################################################################################
def get_value_prompt(prompt, vartype, condition, condition_value, error_string, default_value):
try:
var = vartype(raw_input(prompt))
if not(condition(var,condition_value)):
@karthikeyann
karthikeyann / sendMailViaGmail.php
Last active August 29, 2015 13:56 — forked from hmkz/sendMailViaGmail.php
Send mail via your gmail account to anyone.
<?php
// NOTE: Make this file not readable to others.
/**
* Gmail
* Pear::Mail
* @param string $to
* @param string $from
* @param string $bcc BCC
* @param string $subj
* @param string $body
@karthikeyann
karthikeyann / meminfo.py
Created January 24, 2014 06:28
Compiles CUDA file and displays Kernel memory requirements in a table (removes hassle of searching nvcc -Xptxas=-v output)
#!/usr/bin/python
#Compiles CUDA file and displays Kernel memory requirements in a table
import sys
import subprocess
def startpos(line):
found=0;
val=0;
for each in line:
if(found==0 and (each in "1234567890")):
found=1