Skip to content

Instantly share code, notes, and snippets.

View komalsrathi's full-sized avatar
🌎
Working from home

Komal Rathi komalsrathi

🌎
Working from home
View GitHub Profile
@komalsrathi
komalsrathi / get_module_version.sh
Created December 30, 2015 18:37
Get version of Perl module
#!/bin/bash
# usage bash get_module_version.sh MODULENAME
# module name as first argument
mod=$1
# get version
perl -M$mod -e "print \"$mod: \$$mod::VERSION\n\""
@komalsrathi
komalsrathi / .Rprofile
Last active January 6, 2016 18:43
create .Rprofile in your home directory
# No need to specify repos to install a CRAN package
cat("Setting R repository:http://cran.case.edu\n")
repo = getOption("repos")
# set up the server from which you will download the package.
repo["CRAN"] = "http://cran.case.edu"
options(repos = repo)
rm(repo)
# load BiocInstaller/biocLite when R starts
# you can now directly install bioconductor packages using biocLite('package-name')
@komalsrathi
komalsrathi / .inputrc
Last active April 14, 2016 19:30
You can just type the first letter of your command and move the up and down arrows to track all the commands ran starting that letter
# history search
"\e[A": history-search-backward
"\e[B": history-search-forward
@komalsrathi
komalsrathi / replace_nlchar.sh
Created April 27, 2016 17:36
Replace special character ^M to newline in files generated in OSX.
# usage: bash replace_nlchar.sh <filename>
perl -pi -e 's/\r/\n/g' $1
@komalsrathi
komalsrathi / get_data_from_gdrive.py
Created March 14, 2018 19:15
download large files from google drive
import requests
def download_file_from_google_drive(id, destination):
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
return None
@komalsrathi
komalsrathi / gist:3b979cd61fc986c65bd78140ff10d819
Created July 25, 2018 19:56 — forked from sabarasaba/gist:3080590
Remove directory from remote repository after adding them to .gitignore
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master