[ Launch: Tributary inlet ] 8929330 by infinex
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(rvest) | |
library(tm) | |
library(wordcloud) | |
setwd(paste0(getwd(),'/hwz')) | |
qoo10<-"http://forums.hardwarezone.com.sg/hardware-clinic-2/qoo10-deals-strictly-no-referral-link-part-2-a-5288313.html" | |
last_page<-qoo10 %>% read_html() %>% html_nodes(".pagination a") %>% html_attr('href') %>% na.omit(.) %>% strsplit('-') %>% pluck(13,character(1)) %>% gsub(".html","",.) %>% as.numeric %>% max | |
urls<-vector() | |
for(i in 1:last_page){ | |
urls[i]<-paste0("http://forums.hardwarezone.com.sg/hardware-clinic-2/qoo10-deals-strictly-no-referral-link-part-2-a-5288313-",i,".html") |
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(rgdal) | |
library(sp) | |
library(ggplot2) | |
#you have to supply your own points and polygon | |
postal_code<-read.csv('postalCode/postal_code.csv') | |
shape_rgdal <- readOGR("Planning_Area_Census2010", "Planning_Area_Census2010") | |
shape_rgdal<- spTransform(shape_rgdal , CRS("+proj=longlat +datum=WGS84")) | |
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(ggmap) | |
airports <- read.csv(“https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat", header = FALSE) | |
names(airports) <- c(“id”, “name”, “city”, “country”, “code”, | |
“icao”, “lat”, “lon”, “altitude”, “timezone”, | |
“dst”,”tz”) | |
location <- c( 115,0 ) | |
location | |
map <- get_map(location, zoom=3,maptype=’toner-lite’) | |
p <- ggmap(map) | |
p |
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
LOAD CSV FROM ‘https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat' AS line | |
CREATE (:Airport { myid:toInt(line[0]),name: line[1], lat: line[6],lon: line[7]}) | |
CREATE INDEX ON :Airport(myid) | |
LOAD CSV FROM ‘https://raw.githubusercontent.com/jpatokal/openflights/master/data/routes.dat' AS line | |
MATCH (from:Airport {myid: toInt(line[3])}) | |
MATCH (to:Airport {myid: toInt(line[5])}) | |
MERGE (from)-[r:route]->(to) | |
ON MATCH SET r.count = r.count + 1 ON CREATE SET r.count = 1 |
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 numpy as np | |
import tensorflow as tf | |
import tensorflow.contrib.eager as tfe | |
tfe.enable_eager_execution() | |
from tensorflow.examples.tutorials.mnist import input_data | |
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True) | |
# Training Parameters | |
learning_rate = 0.001 |
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
#BiDirectional LSTM | |
#Training Data | |
# Embedding1,Embedding2,Labels | |
# 1 Jurong,Jurng,1 | |
# 2 Jurong,Jrung,1 | |
# 3 Jurong,Bishan,0 | |
# Purpose: To create measure to determine how similar sequences of inputs are to each other. | |
import os | |
import random |
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
#standard sql | |
#https://stackoverflow.com/questions/38929121/duplicating-records-to-fill-gap-between-dates-in-google-bigquery | |
SELECT day | |
FROM UNNEST( | |
GENERATE_DATE_ARRAY( | |
DATE_TRUNC(DATE_SUB(CURRENT_DATE,INTERVAL 1 YEAR),MONTH) | |
, CURRENT_DATE(), INTERVAL 1 DAY) | |
) AS day |
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
#standard sql | |
SELECT "Current Month" as type,cast(TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), MONTH) as date) | |
UNION ALL | |
SELECT "Week ending",DATE_ADD(cast(TIMESTAMP_TRUNC(CURRENT_TIMESTAMP(), WEEK) as date),interval 7 DAY) | |
UNION ALL | |
SELECT "Current Month",DATE_TRUNC(CURRENT_DATE,MONTH) | |
UNION ALL | |
SELECT "First day of last Month",DATE_TRUNC(DATE_SUB(CURRENT_DATE,INTERVAL 1 MONTH),MONTH) | |
UNION ALL |
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
WITH | |
mydate AS( | |
SELECT | |
day | |
FROM | |
UNNEST( GENERATE_DATE_ARRAY( DATE_TRUNC(DATE_SUB(CURRENT_DATE,INTERVAL 1 YEAR),MONTH), CURRENT_DATE(), INTERVAL 1 DAY) ) AS day ), | |
randomdata AS( | |
SELECT | |
t1.*, | |
ROUND(t1.revenue*rand()) AS user |
OlderNewer