Skip to content

Instantly share code, notes, and snippets.

View shubhamagarwal92's full-sized avatar
☃️
Focusing

Shubham Agarwal shubhamagarwal92

☃️
Focusing
View GitHub Profile
@shubhamagarwal92
shubhamagarwal92 / convertTextToSequence.py
Created April 7, 2017 14:42
This script converts string (sequence of characters) to a sequence of integer values of the unicode characters
# Shubham Agarwal, April 2017
# This script converts string (sequence of characters) to a sequence of integer values of the
# unicode characters
#
# To run this script provide data and output file path. Also provide fileEncoding
# Run as:
# python convertTextToSequency.py --readFilePath='path/to/text/' --writeFilePath='path/to/output'
# Default to 'utf-8' encoding
# Or use --fileEncoding='utf-8'
import os
@shubhamagarwal92
shubhamagarwal92 / generate_beam_topk.py
Created July 25, 2017 08:35
Generate top k predictions from beam search (tf-seq2seq)
#! /usr/bin/env python
# based on https://github.com/google/seq2seq/blob/master/bin/tools/generate_beam_viz.py
import numpy as np
import networkx as nx
import pickle
import argparse
import os
@shubhamagarwal92
shubhamagarwal92 / PEcAn_gsoc_gitlog.txt
Last active August 17, 2017 15:19
GSoC 2017 PEcAn Shiny workflowPlot Git logs
commit 536bb852a72b1ac17dbf27a7c02b8e8ba8831439
Author: shubhamagarwal92 <[email protected]>
Date: Thu Aug 17 09:30:26 2017 -0500
Correcting file path related to input id
commit 19672507fa068276ea76d6cca7a07e6a78ddfac7
Merge: 02f7a03 f062e43
Author: shubhamagarwal92 <[email protected]>
Date: Thu Aug 17 09:28:31 2017 -0500
@shubhamagarwal92
shubhamagarwal92 / convert_excel_to_latex.py
Created August 19, 2018 14:35
This script allows to convert excel line (space separated line) to latex table line format
__author__='shubhamagarwal92'
"""
This script allows to convert excel line (space separated line)
to latex table line format
Usage:
Input:
from wordcloud import WordCloud, STOPWORDS
from PIL import Image
import urllib
import requests
import numpy as np
import matplotlib.pyplot as plt
words = 'access guest guest apartment area area bathroom bed bed bed bed bed bedroom block coffee coffee coffee coffee entrance entry francisco free garden guest home house kettle kettle kitchen kitchen kitchen kitchen kitchen kitchenliving located microwave neighborhood new park parking place privacy private queen room san separate seperate shared space space space street suite time welcome'
mask = np.array(Image.open(requests.get('http://www.clker.com/cliparts/O/i/x/Y/q/P/yellow-house-hi.png', stream=True).raw))
@shubhamagarwal92
shubhamagarwal92 / arxiv.tex
Created September 23, 2018 14:56 — forked from klainfo/ms.tex
Upload LaTeX-generated pdf paper to arXiv without LaTeX sources
\documentclass[letter]{article}
\pdfoutput=1
\usepackage{hyperref}
\hypersetup{
pdfinfo={
Title={title},
Author={author},
}
}
\usepackage{pdfpages}
@shubhamagarwal92
shubhamagarwal92 / jupyter_converter.sh
Created November 12, 2018 14:07
Convert jupyter notebooks
# Sometimes we want to convert jupyter notebook to markdown or
# html when we want to write a blog/README
# Jupyter Notebook Conversion (nbconvert) comes to the rescue
# conda install jupyter will automatically install it
# Run as ./jupyter_converter.sh <filename>
# jupyter nbconvert --to html $1
jupyter nbconvert --to markdown $1
# Run as
# json_beautify.sh bad_json.json beautify.json
# https://stackoverflow.com/questions/352098/how-can-i-pretty-print-json-in-a-shell-script
python -m json.tool $1 > $2
# if the JSON is from an internet source such as an API, you can use
# curl http://my_url/ | python -m json.tool
# For further processing json in python, a good source
# https://www.dataquest.io/blog/python-json-tutorial/
@shubhamagarwal92
shubhamagarwal92 / date2day.py
Created January 17, 2019 17:57
Get the english day from a date
# This example shows for the current date. Modify it to get the day for
# any particular date of the format
# date(year, month, day)
from datetime import date
import calendar
def sample_date2day():
my_date = date.today()
# my_date = date(year, month, day)
@shubhamagarwal92
shubhamagarwal92 / install_torch.sh
Created February 6, 2019 20:41
Install torch on Scientific Linux 7
# https://milindpadalkar.wordpress.com/2016/03/04/installing-torch-without-root-privileges/
# Install conda and create an environment 'torch-env'
source activate torch-env
conda install lua=5.2 lua-science -c alexbw