Skip to content

Instantly share code, notes, and snippets.

@vishalroygeek
vishalroygeek / power_down_notifier.pyw
Created July 19, 2020 02:23
A python script that notifies you whenever there is a power cut ⚡
from win10toast import ToastNotifier
from ping3 import ping
import time
import os
#Defining variables
device_ip_address = "192.168.0.101" #IP address of the device to be pinged
notification_delay = 120.0 #Frequency of the offline notification in seconds
loop_delay = 1.0 #Frequency of device status chekcing in seconds
was_offline = False
@vishalroygeek
vishalroygeek / internet_down_buzzer.py
Last active May 10, 2020 16:49
A python script that helps Raspberry Pi make a beep-beep sound when there is no internet 📡
import RPi.GPIO as GPIO
import time
import urllib.request
#Defining variables
buzzer_pin = 23
def setup():
GPIO.setmode(GPIO.BCM)
@vishalroygeek
vishalroygeek / users_to_csv.py
Last active May 10, 2020 16:47
A python script to get all the user data from firestore database and put it into a CSV file 📁
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
import csv
#Initializing firebase
cred = credentials.Certificate("path/to/serviceAccount.json")
firebase_admin.initialize_app(cred)
db = firestore.client()