Skip to content

Instantly share code, notes, and snippets.

View sanghviharshit's full-sized avatar

Harshit Sanghvi sanghviharshit

View GitHub Profile
@sanghviharshit
sanghviharshit / Mila GraphQL SDL.gql
Created June 6, 2022 18:43
Mila Air Purifier GraphQL Schema Definition Language. The graphql endpoint is at https://api.milacares.com/graphql.
enum AggregateFunction {
Mean
Max
Min
Last
}
input AggregateWindowInput {
range: RangeInput!
every: DurationInput!
@sanghviharshit
sanghviharshit / cbz-from-jpg.py
Created March 22, 2022 05:29
Batch creates cbz files for comic book reader from a directory containing directories of jpgs. e.g. downloaded collections using Tachiyomi mobile app.
from typing import List
from zipfile import ZipFile
import glob
import os
from os.path import basename, dirname, exists
# Zip the files from given directory that matches the filter
def zipFilesInDir(dirName, zipFileName, filter):
print("===Creating CBZ from " + dirName + ": " + zipFileName)
# create a ZipFile object
@sanghviharshit
sanghviharshit / docker-compose-ultimate-media-management.yml
Created March 14, 2022 02:43
The ultimate fully automated media management setup using docker on my Synology NAS.
version: '3.8'
services:
sonarr:
container_name: sonarr
network_mode: 'bridge'
restart: unless-stopped
ports:
- 8989:8989
image: linuxserver/sonarr:latest
volumes:
@sanghviharshit
sanghviharshit / docker-compose.yml
Created March 14, 2022 01:49
My docker-compose.yml config file for bunch of applications running on my Synology NAS
# - Run 'docker-compose pull'.
# - Run 'docker-compose up -d'.
# - To stop running containers from this compose file - Run docker-compose down
# The env variables are set in .env file in the same directory
version: "3.4"
services:
postgresdb:
image: postgres:13
restart: unless-stopped
@sanghviharshit
sanghviharshit / multisensor.yaml
Created March 14, 2022 00:14
Multisensor config file for configuring the ESP8266 with bunch of sensors using ESPHome
esphome:
name: multisensor1
platform: ESP8266
board: nodemcuv2
wifi:
ssid: My-AP
password: SecretPassword
api:
@sanghviharshit
sanghviharshit / mila_api_scratchpad.py
Last active January 8, 2024 06:41
Scratch pad for working with Milacares API for monitoring and controlling Mila air purifier. Read my blog post for more details - https://blog.sanghviharshit.com/reverse-engineering-private-api-ssl-pinning/
# Scratch pad for working with Milacares API for monitoring and controlling their air purifier devices.
# Based on the code from https://www.stefaanlippens.net/oauth-code-flow-pkce.html for PKCE code verifier and challenge.
import base64
import hashlib
import html
import json
import os
import re
import urllib.parse
'''
Netgear Meural mobile app or web interface doesn't give the ability easily delete all the user uploaded items which are not in any of the playlists.
When you delete a playlist, it doesn't delete the items from the playlist and they consume the limited upload space for the user.
Use this file to identify all the uploaded items curently not part of any playlists and delete them to recover some upload space.
usage: python3 meural_clean_uploads.py
'''
import requests
Shortcode
Images:
https://www.shutterstock.com/image-photo/beautiful-beach-chairs-on-sandy-near-633002651
https://www.shutterstock.com/image-photo/madrid-jun-22-linkin-park-music-675309976
https://youtu.be/uGy_HvUaHpg
Photographer:
Christian Bertrand https://www.shutterstock.com/g/Christian+Bertrand
Stephanie Frey https://www.shutterstock.com/g/Stephanie+Frey