Skip to content

Instantly share code, notes, and snippets.

async function portForward(podName, localPort, remotePort) {
return new Promise((resolve, reject) => {
const child = spawn('oc', ['port-forward', podName, `${localPort}:${remotePort}`]); // , { stdio: 'inherit' });
['exit', 'SIGINT', 'SIGUSR1', 'SIGUSR2', 'uncaughtException', 'SIGTERM'].forEach(signal => {
process.on(signal, () => {
child.stdin.pause();
child.kill();
});
});
#include <Arduino.h>
#include "MHZ19.h"
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#define RX_PIN 12
#define TX_PIN 13
#define BAUDRATE 9600
#include <M5Stack.h>
#include "Free_Fonts.h"
#include <Wire.h>
#include "DFRobot_SHT20.h"
#include <WiFi.h>
#include <PubSubClient.h>
#define TFT_GREY 0x7BEF
#define DATA_LEN 32
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
#include <Wire.h>
#include <Adafruit_BMP280.h>
#define WLAN_SSID "*"
#define WLAN_PASS "*"
#define SERVER "*"
#include "LowPower.h"
#define TONE_C 262
#define TONE_D 294
#define TONE_E 330
#define TONE_F 349
#define TONE_G 392
#define TONE_A 440
#define TONE_B 493
#include <Wire.h>
#include <WiFi.h>
#include <SparkFunBME280.h>
#include <SparkFunCCS811.h>
#include "Adafruit_Si7021.h"
#include <MQTT.h>
#define CCS811_ADDR 0x5A
#define BMP280_ADDR 0x76
#define SI2071_ADDR 0x40
#include <Arduino.h>
#include "MHZ19.h"
#include <SoftwareSerial.h> // <--- Remove if using HardwareSerial / ESP32
#define RX_PIN 7
#define TX_PIN 6
#define BAUDRATE 9600 // Native to the sensor (do not change)
MHZ19 myMHZ19;
SoftwareSerial mySerial(RX_PIN, TX_PIN);
#include <SoftwareSerial.h>
const byte s8_co2[8] = {0xfe, 0x04, 0x00, 0x03, 0x00, 0x01, 0xd5, 0xc5};
const byte s8_fwver[8] = {0xfe, 0x04, 0x00, 0x1c, 0x00, 0x01, 0xe4, 0x03};
const byte s8_id_hi[8] = {0xfe, 0x04, 0x00, 0x1d, 0x00, 0x01, 0xb5, 0xc3};
const byte s8_id_lo[8] = {0xfe, 0x04, 0x00, 0x1e, 0x00, 0x01, 0x45, 0xc3};
SoftwareSerial swSer(9,8); // RX, TX
byte buf[10];
uint16_t co2;
#include <MQTT.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include "Adafruit_Si7021.h"
#define PUB_INTERVAL 30000
unsigned long lastPublishMillis = 0;
#include <string.h>
#include <U8g2lib.h>
#define PM10PIN 3
#define PM25PIN 6
#define ALARMSOUNDER 8
int i;
unsigned long duration10;
unsigned long duration25;