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
# Using Debian GNU/Linux 10 (buster) | |
# Create local SSD file system and mount | |
sudo mkfs.ext4 -F /dev/nvme0n1 | |
sudo mkdir -p /mnt/disks/nvme0n1 | |
sudo mount /dev/nvme0n1 /mnt/disks/nvme0n1 | |
sudo chmod a+w /mnt/disks/nvme0n1 | |
cd /mnt/disks/nvme0n1 | |
# Update |
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
#!/usr/bin/env python3 | |
from google.cloud import bigquery | |
import pandas as pd | |
# Specify your dataset | |
project_id = "your_project_here" | |
dataset_id = "your_dataset_here" | |
# Specify how far back you want to look through your job history, up to 180 days | |
job_history_lookback_days = 2 |
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
#!/usr/bin/env python3 | |
from google.cloud import bigquery | |
import pandas as pd | |
client = bigquery.Client() | |
# Specify your dataset | |
project_id = "your_project_here" | |
dataset_id = "your_dataset_here" |
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
#!/usr/bin/env python3 | |
import argparse | |
import configparser | |
import json | |
import shutil | |
import sys | |
from os import makedirs | |
from os.path import join | |
from time import sleep |
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
#!/usr/bin/env python3 | |
import argparse | |
import configparser | |
import json | |
import random | |
import sys | |
from os.path import join | |
from time import sleep | |
from awscrt import io, mqtt |
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
#!/usr/bin/env python3 | |
import argparse | |
import configparser | |
import datetime | |
import json | |
import time | |
from glob import glob | |
from os.path import join | |
from awscrt import io, mqtt |
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
bq load \ | |
--replace \ | |
--skip_leading_rows 1 \ | |
--source_format=CSV \ | |
${PROJECT_ID}:sensordata.temperature \ | |
gs://${BUCKET_NAME}/temperature.csv.gz \ timestamp_utc:DATETIME,timestamp_epoch:INTEGER,temp_f:FLOAT,temp_c:FLOAT,device_id:INTEGER |
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
google-cloud-bigquery-storage | |
pandas | |
pyarrow |
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 smtplib | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from google.cloud import bigquery | |
from google.cloud import bigquery_storage | |
def open_window_alert(_): | |
project_id = "YOUR_PROJECT_ID" | |
from_email = "YOUR_EMAIL" |
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
# Predict whether window was open in the last 30 seconds | |
cat >predict.sql << EOL | |
DECLARE now_time DATETIME; | |
DECLARE lookback_time DATETIME; | |
DECLARE monitor_window INT64; | |
DECLARE lookback_time_monitor_window DATETIME; | |
SET now_time = CURRENT_DATETIME(); | |
SET lookback_time = DATETIME_SUB(now_time, INTERVAL 2400 SECOND); | |
SET monitor_window = 600; --The amount of time a window should be allowed to be open. Max value of 1800s. | |
SET lookback_time_monitor_window = DATETIME_SUB(now_time, INTERVAL monitor_window SECOND); |
NewerOlder