This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
free -m | |
sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches" | |
free -m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var today = new Date(); | |
var localToday = new Date(today.getTime()-today.getTimezoneOffset()*60000); | |
var localToday_str=localToday.toISOString().substring(0, 10); | |
console.log(localToday_str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mask=card_mask(img) | |
BW_a=imbinarize(img,'adaptive'); | |
BW_g=imbinarize(img,'global'); | |
cc_a=bwconncomp(BW_a,4); | |
cc_g=bwconncomp(BW_g,4); | |
obj_sizes_a=cellfun('length',cc_a.PixelIdxList); | |
obj_sizes_g=cellfun('length',cc_g.PixelIdxList); | |
[px_count_a,idx_a]=max(obj_sizes_a); | |
[px_count_g,idx_g]=max(obj_sizes_g); | |
mask=false(size(img)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ out_cell ] = bool2str( bool_in,varargin) | |
%BOOL2STR Converts boolean values to string. | |
% BOOL2STR(B) returns a cell of 'True' or 'False' corresponding to the | |
% boorean values supplied in vector B. | |
% | |
% BOOL2STR(B,{'Noooo!','Yeah!'}) takes custom stings to correspond to the | |
% boolean values. | |
% | |
% Example: | |
% bool2str(logical([1 0 0 1]),{'Noooo!','Yeah!'}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A CSS skeleton extracted from bootstrap.css to define responsive classes. | |
Make sure you define classes for each screen size and you should have a responsive design :-) | |
*/ | |
/* print */ | |
@media print { | |
} | |
/* universal */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The S&P 500 Stock List. | |
# From - https://en.wikipedia.org/wiki/List_of_S%26P_500_companies | |
# | |
# Bharath Bhushan Lohray | |
# | |
S_P_500 = ['MMM', 'ABT', 'ABBV', 'ACN', 'ATVI', 'AYI', 'ADBE', 'AAP', 'AES', 'AET', 'AFL', 'AMG', 'A', 'APD', 'AKAM', 'ALK', 'ALB', 'AGN', 'LNT', 'ALXN', 'ALLE', 'ADS', 'ALL', 'GOOGL', 'GOOG', 'MO', 'AMZN', 'AEE', 'AAL', 'AEP', 'AXP', 'AIG', 'AMT', 'AWK', 'AMP', 'ABC', 'AME', 'AMGN', 'APH', 'APC', 'ADI', 'ANTM', 'AON', 'APA', 'AIV', 'AAPL', 'AMAT', 'ADM', 'ARNC', 'AJG', 'AIZ', 'T', 'ADSK', 'ADP', 'AN', 'AZO', 'AVB', 'AVY', 'BHI', 'BLL', 'BAC', 'BK', 'BCR', 'BAX', 'BBT', 'BDX', 'BBBY', 'BRK', 'BBY', 'BIIB', 'BLK', 'HRB', 'BA', 'BWA', 'BXP', 'BSX', 'BMY', 'AVGO', 'BF', 'CHRW', 'CA', 'COG', 'CPB', 'COF', 'CAH', 'HSIC', 'KMX', 'CCL', 'CAT', 'CBG', 'CBS', 'CELG', 'CNC', 'CNP', 'CTL', 'CERN', 'CF', 'SCHW', 'CHTR', 'CHK', 'CVX', 'CMG', 'CB', 'CHD', 'CI', 'XEC', 'CINF', 'CTAS', 'CSCO', 'C', 'CFG', 'CTXS', 'CLX', 'CME', 'CMS', 'COH', 'KO', 'CTSH', 'CL', 'CMCSA', 'CMA', 'CAG', 'CXO', 'COP', 'ED', 'S |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Code by Bharath Bhushan Lohray | |
# https://bharath.lohray.com/ | |
# github: lordloh | |
# bitbucket: lordloh | |
PART_ID="926fc38e-bc7e-467a-953e-25c6555939a0" | |
now=$(date) | |
echo "===== Running at $now =====" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you hardcode usernames and passwords, you cannot check in the code to public git repositories. | |
# A solution I am using is to create a `credentials.json` file and storing the password there | |
# cerdentials.json : | |
# { | |
# "user":"bharath", | |
# "password":"bharath_secret_password" | |
# } | |
# | |
# add this file to .gitignore | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python functions to get historic stock data. | |
# Use the yql_stock_long_history wrapper. Yahoo does not return data if long requests are made - | |
# For example GOOG form 2001-01-01 to today. The wrapeer breaks the query into multiple 1y queries | |
# and combines the results | |
import json | |
import urllib | |
import time | |
from datetime import datetime, timedelta, date |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Code by Bharath Bhushan lohray | |
# https://bharath.lohray.com/ | |
# github: lordloh | |
# bitbuckte: lordloh | |
def dict_factory(cursor, row): | |
d = {} | |
for idx, col in enumerate(cursor.description): | |
d[col[0]] = row[idx] |
NewerOlder