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
// Arduino digital pin serial control | |
// Ben Fasoli | |
// | |
// Takes input strings over a standard serial connection and sets | |
// digital pins high/low. | |
// | |
// Input: | |
// Set pin# to 0,1 (LOW, HIGH) | |
// [pin#].[0,1]\n | |
// 2.1\n |
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
// Air sensor 1 | |
// Ben Fasoli | |
// | |
// Arduino based platform to measure temperature, relative humidity, | |
// pressure, CO2, and PM. | |
// Libraries | |
#include <dht.h> | |
#include <Adafruit_BMP085.h> | |
#include <Adafruit_GPS.h> |
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/python | |
# Ben Fasoli | |
import datetime | |
import RPi.GPIO as GPIO | |
from time import sleep | |
std_pins = [11, 13, 15, 29] | |
qc_pins = [11, 13, 15, 31, 33] | |
all_pins = [11, 13, 15, 29, 31, 33] | |
t = datetime.datetime.utcnow() |
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
#!/bin/bash | |
# SOCKS proxy via ssh tunnel for MacOS | |
# Install to /usr/local/bin/tunnel with: | |
# curl https://gist.githubusercontent.com/benfasoli/543c14c90a4909e0305180bd8423969e/raw/ > /usr/local/bin/tunnel && chmod +x /usr/local/bin/tunnel | |
TARGET=$1 | |
if [ -z "$TARGET" ]; then | |
echo -n "SSH target (e.g. [email protected]): " | |
read TARGET | |
fi |
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
# Ben Fasoli | |
# Last updated: 12/21/2016 | |
# | |
# Ported from LazyBear's Pine script port | |
# https://www.tradingview.com/u/LazyBear/ | |
# | |
# For an introduction, watch | |
# https://www.youtube.com/watch?v=7vhIsk51_Ro | |
# https://www.youtube.com/watch?v=MqJ1czF220M |
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/python | |
# GRIMM data collection script | |
# Ben Fasoli | |
import serial as ser # serial port use | |
import datetime # time stamps (UTC) | |
import re # regular expression matching | |
# Path to serial device ID | |
serialpath = '/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0' |
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/python | |
# Ben Fasoli | |
# Maintain an internet connection by monitoring outgoing requests to google's | |
# dns server (8.8.8.8) | |
import os | |
from time import sleep | |
def ping(host = '8.8.8.8'): | |
print('Attempting outgoing connection') |
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
from flask import Flask, request, redirect | |
import requests | |
app = Flask(__name__) | |
@app.route('/fetch_cr1000', methods=['GET']) | |
def fetch_cr1000(): | |
try: | |
ip = request.args.get('ip') | |
table = request.args.get('table') |
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
# Ben Fasoli | |
rm(list = ls()) | |
library(gtrendsR) | |
library(tidyverse) | |
# Get google trend data for searches for skis and ski boots | |
query <- c('skis', 'ski boots') | |
trend <- gtrends(query, geo = 'US', time = 'all') | |
trend_ts <- trend$interest_over_time %>% |
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(raster) | |
library(rgdal) | |
# Load footprint from file into rasterBrick object | |
path_to_footprint_nc <- './footprint.nc' | |
footprint <- brick(path_to_footprint_nc) | |
# Sum values per-cell into raster object | |
r_all <- sum(footprint) |
OlderNewer