Skip to content

Instantly share code, notes, and snippets.

View cimentadaj's full-sized avatar

Jorge Cimentada cimentadaj

View GitHub Profile
https://airflow.readthedocs.io/en/latest/start.html
sudo apt-get install python3-pip
sudo apt-get install postgresql postgresql-contrib
sudo -u postgres createuser --interactive
name: airflow
superuser: yes
# The delimiter must appear the same number of times in each row
# and should be present in all rows
# Keeping in line with the guess from readr::read_csv, we can use the
# first 1000 rows to guess the delimiter but also offer to increase the
# guess number
# this is ;
csv_delim("https://datosabiertos.ayto-arganda.es/dataset/4e2b6867-0c88-4b2e-a290-bad625a9b3ac/resource/740d3e9c-735a-4145-9149-7af8eb9e8405/download/registro-de-entrada.-4-trimestre-2017.-oficinas-de-registro.csv")
# this is ,
install.packages(c("essurvey", "ggplot2", "dplyr", "purrr"))
library(essurvey)
library(ggplot2)
library(purrr)
library(dplyr)
# Saves your email to log in to the ESS website
set_email("[email protected]")
# install.packages("essurvey")
library(essurvey)
library(ggplot2)
library(purrr)
library(dplyr)
# Saves your email to log in to the ESS website
set_email("[email protected]")
library(tidyverse)
## This gist allows to add keywords to bibentries
## It checks whether the keyword exists and if it doesn't
## it adds it. It does this by parsing all entries from a file,
## matchin these entries to the .bib file and adding the keyword
## only to those keywords that matched. This is handy when wanting
## to create a new chapter and add that chapters keyword only for the authors
## actually cited in that chapter
library(tidybayes)
library(bayesplot)
library(tidyverse)
# Download file from
# https://github.com/cimentadaj/phd_thesis/blob/chapter3/chapter3/mod1.rda
model <- read_rds("../../mod1.rda")
original_labels <- paste0("t(", grep("b_I|lp__", parameters(model), value = TRUE,
invert = TRUE),
import requests
from datetime import datetime
from pytz import timezone
import psycopg2
from psycopg2.extensions import AsIs
r = requests.get(url='http://wservice.viabicing.cat/v2/stations')
stations = r.json()['stations']
time = str(datetime.now(timezone("Europe/Madrid")))
library(DBI)
library(RMySQL)
library(modelr)
library(rdrop2)
library(data.table)
library(parallel)
library(doParallel)
library(lubridate)
library(caret)
library(randomForest)
library(httr)
library(jsonlite)
library(DBI)
library(purrr)
test_url <-
paste0(
"http://opendata-ajuntament.barcelona.cat/data/api/3/action/resource_search?query=name:",
"bicing"
)
andrea <- data.frame(
date = seq(as.Date("2017-01-01"), as.Date("2017-12-31"), "days"),
felicidad_jorge = c(rnorm(188, 5, 0.2), rnorm(105, 5, 0.02) + seq(0.01, 3, length.out = 105),
rep(NA, 72)),
color = as.character(c(rep(1, 188), rep(2, 105), rep(NA, 72)))
)
library(tidyverse)
library(extrafont)