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 os | |
os.environ["OPENAI_API_KEY"] = "" | |
from flask import Flask, Response, request | |
import threading | |
import queue | |
from langchain.chat_models import ChatOpenAI | |
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler | |
from langchain.schema import AIMessage, HumanMessage, SystemMessage |
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
# Geographical Data ------------------------------------------------------- | |
library(dplyr) | |
# download geospatial data for NUTS-3 regions | |
euro_nuts3_sf <- | |
eurostat::get_eurostat_geospatial(output_class = 'sf', resolution = '60', nuts_level = 3) %>% | |
sf::st_transform(crs = 3035) |
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(eurostat) # eurostat data | |
library(rnaturalearth) # worldwide map data | |
library(tidyverse) # tidy data transformation | |
library(lubridate) # date and time support | |
library(sf) # simple features GIS | |
euro_pop <- | |
get_eurostat('demo_r_pjanaggr3', stringsAsFactors = FALSE) %>% | |
filter( | |
str_length(geo) == 5, # NUTS-3 |
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 script automates the collection, processing, and plotting of gridwatch energy data | |
# 2019-05-27 | |
# @kiernann | |
# u/WannabeWonk | |
# install.packages("pacman") | |
pacman::p_load( | |
RSelenium, | |
readr, | |
dplyr, |
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 smbus | |
import time | |
DEV_ADDRESS = 0x15 | |
class Bearable(): | |
def __init__(self): | |
self.bus=smbus.SMBus(1) | |
self.leds = [0]*12 |
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
################################################################################ | |
# replication of https://i.redd.it/q0udc4wfhvjz.gif | |
# originally posted to r/dataisbeautiful by u/Tjukanov | |
################################################################################ | |
library(tidyverse) | |
library(gganimate) | |
library(lubridate) | |
#data from: https://www.ncdc.noaa.gov/ibtracs/index.php?name=wmo-data | |
df <- read_csv("Allstorms.ibtracs_wmo.v03r09.csv") |
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
################################################################################ | |
# | |
# ikashnitsky.github.io 2017-07-18 | |
# Accessing Eurostat data using the `eurostat` R package | |
# Young people neither in employment nor in education and training in Europe | |
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com | |
# | |
################################################################################ | |
library(tidyverse) |
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 1 column, instead of 2 in line 7.
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
code;name | |
01;Personal Care Activities | |
0101;Sleeping | |
0102;Grooming | |
0103;Health-related self care | |
0104;Personal Activities | |
0105;Personal Care Emergencies | |
0199;Personal care, n.e.c.* | |
02;Household Activities | |
0201;Housework |
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(tidyverse) | |
library(stringr) | |
# read in the transcript | |
# I simply copied the text from the page at | |
# https://www.washingtonpost.com/news/the-fix/wp/2016/09/26/the-first-trump-clinton-presidential-debate-transcript-annotated/ | |
# and popped it into a txt file | |
xx <- scan("first_debate_2016.txt", "character") |
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(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(animation) | |
#Data from https://crudata.uea.ac.uk/cru/data/temperature/ | |
#As well as data read in script | |
source("read_cru_hemi.R") | |
temp_dat <- read_cru_hemi("./HadCRUT4-gl.dat") | |
#remove cover |
NewerOlder