Skip to content

Instantly share code, notes, and snippets.

View felipsant's full-sized avatar

Felipe Santiago Monteiro da Silva felipsant

View GitHub Profile
@felipsant
felipsant / AircraftExtractorMD.R
Last active November 3, 2017 11:45
Web Scraping Airships
library(rvest)
library(dplyr)
library(stringr)
library(plyr)
# Small example reading airbushelicoptersinc.com website.
helicopters_name <- c("h120","h125","h130","h135","h145","ec145")
# name <- helicopters_name[1]
get_helicopter_data <- function(name){
helicopterHTML <- read_html(paste0("http://airbushelicoptersinc.com/products/", name, "-specifications.asp"))
import urllib2
from BeautifulSoup import BeautifulSoup
import re
URL = 'http://www.tudogostoso.com.br/'
opener = urllib2.build_opener()
opener.addheaders = [('User-Agent', 'Mozilla/5.0')]
page = opener.open(URL).read()
soup = BeautifulSoup(page)
# soup.prettify()
# soup_categorias.prettify()
@felipsant
felipsant / Cypher - Select_Post
Last active November 2, 2017 04:50
santiagocloud-website
MATCH(P:Post)
OPTIONAL MATCH (U:User)
OPTIONAL MATCH(U)-[R:RATES_ON]-(P)
OPTIONAL MATCH(U)-[WRITES_COMMENT]-(C:Comment)-[RELATES_TO_POST]-(P)
return P.uuid as uuid, P.releasedDate as releasedDate, P.languages as languages,
P.title as title, P.appIcon as appIcon, P.appName as appName,
P.description as description, P.imgSrc as imgSrc, P.src as src,
COALESCE(round(10.0^2 *avg(toFloat(R.rate)))/10.0^2,0) as avgRate, count(C) as qtdComments;
def exists(node=None, property=None, value=None):
filter_node = (":" + node) if node != None else ''
filter_value = ("{" + property + ": '" + value + "'}") if property != None and value != None else ''
return db.cypher_query("MATCH(n" + filter_node + filter_value + ")" + " return count(n) > 1 as exists, count(n) as qtd;" )[0][0]
exists(node='User')['exists'] or exists(node='User')[0]
@felipsant
felipsant / [Api]-Dockerfile
Last active October 16, 2016 20:40
Docker
FROM python:2.7-alpine
MAINTAINER Felipe Santiago
RUN apk add --update libffi-dev gcc musl-dev
RUN mkdir -p /src/api/api
ADD requirements.txt requirements.txt
ADD /api /src/api/api
RUN pip install -r requirements.txt;
@felipsant
felipsant / afterInstall.bash
Last active June 22, 2016 23:07
AWSCodeDeploy
cd /MineURL/OTHERFOLDER/ANotherFolder/nginx/SCWeb
bower install --allow-root
chown -R myuser:myser /MineURL/OTHERFOLDER/ANotherFolder/SCServices
chmod 755 /MineURL/OTHERFOLDER/ANotherFolder/SCServices/CurrencyReader/job.sh
@felipsant
felipsant / HootSuiteVanhacton.adoc
Last active May 24, 2016 03:27
HootSuite_Vanhackton_DataScientist
:neo4j-version: 3.0.1
:author: Felipe Santiago
CREATE      (service_HootSuite:Service {id:'1',name:'HootSuite'}),
            (service_Twitter:Service {id:'2',name:'Twitter'}),
            (service_Linkedin:Service {id:'3',name:'Linkedin'}),
            (endPoint_TWGet:EndPoint{id:'4',name:'Twitter-Get'}),
            (service_Facebook:Service {id:'4',name:'Facebook'}),
@felipsant
felipsant / global.R
Last active January 5, 2018 17:09
SC-CurrencyReader
#install.packages("tidyr")
library(RMySQL)
library(DBI)
library(tidyr)
# Connect to the MySQL database: con
con <- dbConnect(RMySQL::MySQL())
currencyData <- dbGetQuery(con, "select cu.code,
cv.timestamp,