This file contains hidden or 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 nodemailer from 'nodemailer'; | |
import * as dotenv from 'dotenv'; | |
import fs from 'fs'; | |
// Load environment variables | |
dotenv.config(); | |
const sendEmail = async () => { | |
try { | |
// Read recipients and email content from .env |
This file contains hidden or 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 puppeteer from 'puppeteer'; | |
import * as dotenv from 'dotenv'; | |
// Load environment variables | |
dotenv.config(); | |
const generatePDF = async () => { | |
try { | |
// Load URL, username, and password from environment variables | |
const url = process.env.PDF_URL || 'https://example.com'; |
This file contains hidden or 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
<script> | |
import { onMount } from 'svelte'; | |
import { AllCommunityModule, ModuleRegistry, createGrid } from 'ag-grid-community'; | |
export let data = []; | |
ModuleRegistry.registerModules([AllCommunityModule]); | |
function calculateColumnWidth(data) { | |
return Object.keys(data).map(field => { |
This file contains hidden or 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
PIVOT( | |
select | |
date, | |
contractname as candidate, | |
substring(closeshareprice,2,10)::double as implied_probability | |
from read_csv('https://www.predictit.org/Resource/DownloadMarketChartData?marketid=7456×pan=30d') | |
--where candidate in ('Trump', 'Harris', 'Biden') | |
order by date desc, implied_probability desc | |
) | |
ON candidate using sum(implied_probability) |
This file contains hidden or 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 cleaned_docs as ( | |
select | |
tweet_id, | |
regexp_replace(regexp_replace(text, '\\n', ' ', 'g'), 'https[^\\s]+', '', 'g') as cleaned_text | |
from tweets | |
where text is not null | |
), | |
tokenized_docs as ( | |
select |
This file contains hidden or 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
INSTALL 'icu'; | |
LOAD 'icu'; | |
SET TimeZone = 'Europe/Berlin'; | |
create or replace table metrics as SELECT TIMESTAMP '2024-06-07 00:00:00' AS mytimestamp, TIMESTAMP WITH TIME ZONE '2024-06-07 00:00:00+02' AS mytimestamptz, 1000 AS sales, 50 AS orders, 20 AS customers; | |
-- Check the stored timestamps to ensure they match Berlin time | |
SELECT |
This file contains hidden or 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
SELECT | |
regr_slope(num_orders, sales) AS slope, | |
regr_intercept(num_orders, sales) AS intercept, | |
regr_r2(num_orders, sales) AS r_squared | |
FROM orders_by_state |
This file contains hidden or 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
/** | |
* Reads the manifest file and creates a schema and table for each parquet file in the manifest. | |
* It will create a DB called `local.duckdb` in the root of the project. | |
* | |
* Usage: | |
* 1. Copy this file to the root of your project Evidence project. | |
* 2. `npm run sources` | |
* 3. `node createLocalDuckDB.js` | |
*/ |