Skip to content

Instantly share code, notes, and snippets.

View shamasis's full-sized avatar

Shamasis Bhattacharya shamasis

View GitHub Profile
@shamasis
shamasis / muppy.js
Created July 9, 2024 11:43
OpenAI CLI chatbot
const OpenAI = require('openai'),
readline = require('readline');
// Initialize OpenAI with API key
const openai = new OpenAI({
apiKey: "" // your-api-key-here
// For extra safety, use the line below, comment the line above and pass the API key as an environment variable:
// apiKey: process.env['OPENAI_API_KEY']
});
@shamasis
shamasis / climate.yaml
Created June 6, 2024 14:29
ESPHome Climate Controller
substitutions:
name: climate-control-esph-1337
friendly_name: Climate Control ESPH-1337
pin_status_led: GPIO2
pin_transmitter: GPIO4
pin_receiver: GPIO12
pin_dht: GPIO14
esphome:
name: ${name}
@shamasis
shamasis / esp32.blink.ino
Created June 4, 2024 10:46
Sample sketch that blinks ESP32 built-In LED to smoke test everything works
# This is an ESPHome configuration for an Outdoor Weather Station.
# The configuration includes a raindrop coverage sensor and a rain sensor.
# The raindrop coverage sensor uses an ADC to measure water resistance,
# while the rain sensor is a digital sensor indicating whether it is raining or not.
#
# The configuration uses substitutions to define all the configurable parts,
# making it easy to adjust pins and other settings without modifying the entire file.
substitutions:
name: esph-29697f-ows-1
@shamasis
shamasis / say-watch.sh
Created May 5, 2021 12:48
Make your Mac remind you every 30 seconds
watch -n 30 say It is time
@shamasis
shamasis / stop-media-indexing.sh
Created October 21, 2020 08:19
Bash commands to turn off CPU aggressive services on WD MyCloud EX
/etc/init.d/wdmcserverd stop
/etc/init.d/wdphotodbmergerd stop
@shamasis
shamasis / main.cpp
Created March 22, 2020 15:52
TOTP Generator for ESP32 OLED module
#include <WiFi.h>
#include <NTPClient.h>
// dependencies
#include "TOTP++.h"
#include "SSD1306.h"
// replace with your network credentials
const char* ssid = "Redacted";
const char* password = "Redacted";
@shamasis
shamasis / keybase.md
Last active July 29, 2019 22:37
keybase.md

Keybase proof

I hereby claim:

  • I am shamasis on github.
  • I am shamasis (https://keybase.io/shamasis) on keybase.
  • I have a public key ASCK9Os-xiDRUyZBtzeVqOSZxOzAp7I-00B11_Jb1Xs2xQo

To claim this, I am signing this object:

@shamasis
shamasis / arduino.ino
Created June 16, 2019 08:52
ESP8266 Remote DHT Sensor
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include "DHT.h"
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
int LED_PIN = LED_BUILTIN; // amica
const char* ssid = "Your wifi SSID"; // Enter SSID here
const char* password = "Your wifi password"; //Enter Password here
@shamasis
shamasis / fix-npm-raspbian.sh
Created May 4, 2019 17:07
Fixing npm global install on Raspbian
# run the following commands
sudo mkdir /usr/local/lib/node_modules;
sudo chown pi /usr/local/lib/node_modules;