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 found in the stackoverflow question. | |
getSQL <- function(filepath){ | |
con = file(filepath, "r") | |
sql.string <- "" | |
while (TRUE){ | |
line <- readLines(con, n = 1) | |
if ( length(line) == 0 ){ |
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
from urllib.request import urlopen | |
from bs4 import BeautifulSoup | |
import time | |
import pandas as pd | |
import re | |
def open_list_page(url): | |
try: | |
html = urlopen(url).read() |
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
train_vec <- sample(1:nrow(iris),size = 0.7*nrow(iris)) | |
iris[,-length(iris)] <- lapply(iris[,-length(iris)], as.numeric) | |
tr <- iris[train_vec, -length(iris) ] | |
tr_label <- iris[train_vec, "Species"] | |
test <- iris[-train_vec, -length(iris)] |
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
#Easy way is to navigate to the folder where your file/folders lie and then - | |
gcloud compute scp FILENAME sudevchirappat@gcmbox:"/home/sudevchirappat/" | |
#Note : change FILENAME to the file you need upload | |
#If an entire folder needs to be moved use the recursion flag. | |
gcloud compute scp --recurse FOLDERNAME sudevchirappat@gcmbox:"/home/sudevchirappat/" | |
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
#x is the column which has the excel date-time integers. | |
#Generally looks like 43144 (February 13, 2018) | |
#Timezone should be the same timezone excel has been opened with. IST in this specific example | |
as.POSIXct(x*60*60*24, tz = "IST", origin = "1899-12-30") |
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
library(coreNLP) | |
library(qdap) | |
#Load the textData from csv | |
textData <- read.csv("comments.csv") | |
initCoreNLP(libLoc = "C:/Users/schirappat/Documents/R/win-library/3.3/coreNLP/extdata/stanford-corenlp-full-2016-10-31",mem = "8g", type = "english") | |
#Restart the machine if memory allocation error occurs |
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 tweepy | |
import jsonpickle | |
import json | |
import unicodecsv as csv | |
import pandas as pd | |
import numpy as np | |
import os | |
from datetime import date | |
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
1033edge.com | |
11mail.com | |
123.com | |
123box.net | |
123india.com | |
123mail.cl | |
123qwe.co.uk | |
150ml.com | |
15meg4free.com | |
163.com |
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
# This is shorthened version of blog post | |
# http://ksopyla.com/2017/02/tensorflow-gpu-virtualenv-python3/ | |
# update packages | |
sudo apt-get update | |
sudo apt-get upgrade | |
#Add the ppa repo for NVIDIA graphics driver | |
sudo add-apt-repository ppa:graphics-drivers/ppa | |
sudo apt-get update |
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
#This is pretty specific to the use case. | |
#But a good thing to document this method. | |
#Hopefully useful sometime in the future | |
require(data.table) | |
#dt is the data table available | |
#First find counts | |
temp1 <- dt[,.(COUNT = .N),by = Agent] |