Skip to content

Instantly share code, notes, and snippets.

View Hiutaky's full-sized avatar
🎯
Focusing

Alessandro De Cristofaro Hiutaky

🎯
Focusing
View GitHub Profile
@Hiutaky
Hiutaky / mushroom-control-arduino.ino
Created May 4, 2024 14:09
Arduino Program to manage a little mushroom farm. Include 1 rele with 4 input, serial log (for backend purpose) and serial write to send commands.
#include "DHT.h" //by adafruit (download entire library)
#define UPDATE_INTERVAL 10000
//temperature pin, type dht11
#define DHT_P 8
//relé module
#define LED_P A1//12v, 0.5ah - 6w
#define FAN_P A2//12v, 0.5ah - 6w
@Hiutaky
Hiutaky / kucoin-api-fetch.js
Created January 11, 2024 12:24
Google Sheet Crypto Price Fetch via KuCoin API
/**
Paste this script in Google Apps Script, will be available as function in Sheet by using =fetchPrice('SYMBOL') ex =fetchPrice('BTC')
If you want to auto-update the price every time your open the Sheet, in Apps Script click on Triggers and add a new trigger
Select the behavior you prefer and save.
*/
function fetchPrice(symbol = 'BTC') {
const res = UrlFetchApp.fetch(`https://api.kucoin.com/api/v1/market/stats?symbol=${symbol}-USDT`);
const obj = JSON.parse(res.getContentText());
return parseFloat(obj.data.buy)