This file contains 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 findLatLong() { | |
Logger.log(SpreadsheetApp.getActive()); | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var range = sheet.getDataRange(); | |
var numRows = range.getNumRows(); | |
var numCols = range.getNumColumns(); | |
for (var i = 2; i <= numRows; i++) { | |
var locality = range.getCell(i,1).getValue(); | |
This file contains 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
for file in *.jpg; | |
do | |
file ${file%*}; | |
convert -crop 300x300+300+80 $file cropped/$file; | |
#do whatever you want. The filename is in the $file variable. | |
done |
This file contains 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
--- | |
--- | |
<!DOCTYPE html> | |
<html> | |
{% include head.html %} | |
<body itemscope itemtype="http://schema.org/Article"> | |
<script> | |
window.fbAsyncInit = function() { | |
FB.init({ | |
appId : '364481490395389', |
This file contains 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 using for the first time, source the below packages | |
# source("https://bioconductor.org/biocLite.R") | |
# biocLite("org.Mm.eg.db") | |
##Load the db to the environment | |
library("org.Mm.eg.db") | |
## The list of EnsEMBL Gene IDs are stored in a file "ens.txt". Read the text file as a table |
This file contains 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 findLatLong() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
SpreadsheetApp.getUi().alert('Hello, world!'); | |
var startRow = 2; // First row of data to process | |
var numRows = 2; // Number of rows to process | |
// Fetch the range of cells A2:B3 | |
var dataRange = sheet.getRange(startRow, 2, numRows, 2) | |
// Fetch values for each row in the Range. | |
var data = dataRange.getValues(); | |
for (i in data) { |
This file contains 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
import csv | |
#Specify start and end values in decimal | |
range_start = 1 | |
range_stop = 2^15 | |
with open('output_file.csv','w') as out_file: |
This file contains 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
out_file = open("out_file.txt","w") | |
with open('formulas.txt','r') as fil: | |
for lin in fil: | |
#Here, '+' is the unwanted character at the 0th position. Edit accordingly for other characters | |
if(lin[0] == "+"): | |
new_line = lin[1:] | |
print new_line | |
else: |
This file contains 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 to split the dataframe | |
## 143 is just a default seed | |
splitdf <- function(dataframe, seed=143,splitper) { | |
if (!is.null(seed)) set.seed(seed) | |
index <- 1:nrow(dataframe) | |
trainindex <- sample(index, (splitper/100)*trunc(length(index))) | |
trainset <- dataframe[trainindex, ] | |
testset <- dataframe[-trainindex, ] | |
list(trainset=trainset,testset=testset) |
This file contains 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
## Supposed you want to apply an operation to every element in a vector. Efficient way to do it in R is to use sapply / lapply | |
## Sample vector of 100 observation | |
x_vec <- rnorm(100) | |
## Need to find the absolute value of each element | |
x_abs <- sapply(x_vec,abs) | |
## The above implementation equivalent to doing x_abs <- abs(x_vec) |
This file contains 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
import smtplib | |
from os.path import basename | |
from email.mime.application import MIMEApplication | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.utils import COMMASPACE, formatdate | |
import sys | |
import datetime | |
import json |
OlderNewer