Skip to content

Instantly share code, notes, and snippets.

View reefwing's full-sized avatar

David Such reefwing

View GitHub Profile
@reefwing
reefwing / GPT-3 Share Scrape.py
Created March 25, 2023 08:05
NON WORKING share scaping script
# Import necessary modules
import pandas as pd
import requests
# Assign ticker to a variable
ticker = "STW.AX"
# Construct the URL for the API
url = f"https://query1.finance.yahoo.com/v7/finance/quote?symbols={ticker}"
@reefwing
reefwing / ShareScrape.py
Last active March 25, 2023 23:22
Simple share price scraping script
import pandas as pd
import requests
ticker = "STW.AX"
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'}
url = f'https://finance.yahoo.com/quote/{ticker}?p={ticker}'
response = requests.get(url, headers = headers)
summary_data = pd.read_html(response.text)
@reefwing
reefwing / ReefwingLSM9DS1_WhoAmI.h
Created March 22, 2023 07:24
LSM9DS1 Who Am I register check
uint8_t ReefwingLSM9DS1::whoAmIGyro() {
// Read WHO_AM_I register for LSM9DS1 accel/gyro
return readByte(LSM9DS1AG_ADDRESS, LSM9DS1AG_WHO_AM_I);
}
uint8_t ReefwingLSM9DS1::whoAmIMag() {
// Read WHO_AM_I register for LSM9DS1 magnetometer
return readByte(LSM9DS1M_ADDRESS, LSM9DS1M_WHO_AM_I);
}
@reefwing
reefwing / NanoESC1.ino
Created February 26, 2023 07:49
Code stub for Nano ESC
#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>
/******************************************************************
* Nano PIN MAPPING
******************************************************************/
#define MOSI 11
#define DC 1
@reefwing
reefwing / whoAmI.cpp
Created February 19, 2023 06:41
LPS22HB Who Am I Stub
byte ReefwingLPS22HB::whoAmI() {
Wire1.beginTransmission(_address);
Wire1.write(LPS22HB_WHO_AM_I);
Wire1.endTransmission();
Wire1.requestFrom(_address, 1);
return Wire1.read();
}
bool ReefwingLPS22HB::connected() {
return (whoAmI() == LPS22HB_WHO_AM_I_VALUE);
@reefwing
reefwing / Detect_Nano33BLE_Type.ino
Last active February 23, 2023 08:16
An Arduino Sketch to detect the type of Nano 33 BLE (original, SENSE, or SENSE Rev 2)
#include <Wire.h>
#define HTS221_ADDRESS 0x5F // Nano 33 BLE Sense Rev 1 Sensor
#define HS3003_ADDRESS 0x44 // Nano 33 BLE Sense Rev 2 Sensor
enum BoardType {
NANO33BLE,
NANO33BLE_SENSE,
NANO33BLE_SENSE_R2,
XIAO_SENSE,
@reefwing
reefwing / board_name.ino
Created February 7, 2023 07:11
Print out the Arduino BOARD_NAME constant
void setup() {
// Start Serial and wait for connection
Serial.begin(115200);
while (!Serial);
Serial.println(BOARD_NAME);
}
@reefwing
reefwing / hardware_detection.ino
Created February 7, 2023 06:53
Stub Arduino Hardware Detection Sketch
#if defined(ARDUINO_ARCH_NRF52840)
#include "nano33ble.h"
#elif defined(ARDUINO_PORTENTA_H7_M7)
#include "portentah7.h"
#elif defined(ARDUINO_ARCH_MBED_RP2040)
#include "pico.h"
#else
#error "Unsupported Hardware"
#endif // target detection
@reefwing
reefwing / pot.c
Created January 14, 2023 23:48
Code snippet to show reading and displaying the potentiometer value
1. float pot = (((float)analogRead(VPOT) + 0.5) / 1024.0) * 100.0;
2.
3. itoa((int)pot, throttleAsChar, DECIMAL); // itoa = Int to ASCII
4. u8x8.drawString(1, 4, "THROTTLE: ");
5. u8x8.drawString(10, 4, throttleAsChar);
6. u8x8.drawString(14, 4, "%");
@reefwing
reefwing / ReefwingWatch.ino
Created December 12, 2022 23:26
Example modifications to the SimpleFramework
uint32_t wday = 0; // Sunday
uint8_t hh, mm, ss, mmonth, dday; // H, M, S, month & day variables
uint16_t yyear; // Year is 16 bit int
char const* WEEKDAYS[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
void displayTime(boolean fullUpdate) {
int batSOC = ttgo->power->getBattPercentage();
int temp = ttgo->power->getTemp();