Skip to content

Instantly share code, notes, and snippets.

View erikgregorywebb's full-sized avatar
📈

Erik erikgregorywebb

📈
View GitHub Profile
# import
library(webshot)
# set working directory
setwd("~/Downloads")
# extract as .pdf files
webshot("https://www.getdbt.com/analytics-engineering/start-here/", "dbt-1-start-here.pdf")
webshot("https://www.getdbt.com/what-is-analytics-engineering/", "dbt-2-what-is-analytics-engineering.pdf")
webshot("https://www.getdbt.com/analytics-engineering/why/", "dbt-3-why.pdf")
from twilio.rest import Client
try:
# run some code
message = 'Success!'
except:
# if it fails
message = 'Job failed!'
from twilio.rest import Client
# create client
account_sid = 'YOUR-ACCOUNT-SID'
auth_token = 'YOUR-AUTH-TOKEN'
client = Client(account_sid, auth_token)
# define message function
def sendMessage(body, from_, to):
message = client.messages.create(body = body, from_ = from_, to = to)
library(rvest)
url = 'https://genius.com/#top-songs'
page = read_html(url)
top_songs = page %>% html_nodes('.qsIlk') %>% html_attr('href')
# set working directory
setwd("~/Projects/zillow")
# import libraries
library(tidyverse)
library(lubridate)
library(scales)
# define urls for import
url_1_bed = 'https://files.zillowstatic.com/research/public_v2/zhvi/Zip_zhvi_bdrmcnt_1_uc_sfrcondo_tier_0.33_0.67_sm_sa_mon.csv?t=1620762095'
# demo
import pyautogui
import winsound
frequency = 1500 # in Hertz
duration = 200 # 1000 ms == 1 second
winsound.Beep(frequency, duration)
path = r'C:\Users\erikgregorywebb\Documents\..\my_screenshot.png'
pyautogui.screenshot(path)
# set working directory
setwd("~/Projects/zillow")
# import libraries
library(tidyverse)
### REALTOR ###
# import realtor.com
# source: https://www.realtor.com/research/data/ (Inventory, Monthly)
zipcode city county
84001 Altamont Duchesne
84002 Altonah Duchesne
84003 American Fork Utah
84004 Alpine Utah
84005 Eagle Mountain Utah
84006 Bingham Canyon Salt Lake
84007 Bluebell Duchesne
84008 Bonanza Uintah
84010 Bountiful Davis
library(tidyverse)
library(rvest)
# define list of input
years = c('1996', '1998', '2000', '2002', '2004', '2006', '2008', '2010', '2012', '2014', '2016', '2018', '2020')
years_abbr = c('96', '98', '00', '02', '04','06', '08', '10', '12', '14', '16', '18', '20')
# loop over years, combine data
# source: https://www.fec.gov/data/browse-data/?tab=bulk-data
setwd("~/Projects/fec")
variable sex age
B01001_003 Male Under 5 Years
B01001_004 Male 5 to 9 Years
B01001_005 Male 10 to 14 Years
B01001_006 Male 15 to 17 Years
B01001_007 Male 18 and 19 Years
B01001_008 Male 20 Years
B01001_009 Male 21 Years
B01001_010 Male 22 to 24 Years
B01001_011 Male 25 to 29 Years