Skip to content

Instantly share code, notes, and snippets.

@Dacesilian
Dacesilian / JavascriptBeautifierForJava.java
Created July 26, 2021 06:55
How to call beautify.js from Java using GraalJS
// https://github.com/beautify-web/js-beautify
// https://github.com/oracle/graaljs
// Inspired by https://gist.github.com/fedochet/d41442e735eaa277937a094ab8e5fc8f
import org.apache.commons.io.IOUtils;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.HostAccess;
import org.graalvm.polyglot.PolyglotAccess;
import org.graalvm.polyglot.Value;
@Dacesilian
Dacesilian / gist:b117f2194a72e3b7184b802e9cc82c82
Last active February 3, 2021 21:16
Sonoff Mini flashing ESPHome (OTA v2.0)
Needed software:
- HFS HTTP fileserver (for serving firmware file) - https://www.rejetto.com/hfs/?f=dl
- Not all HTTP servers will work, it has to support streaming, I think
- Postman (for instructing device to download file from URL) - https://www.postman.com/downloads/
- OTA protocol documentation: https://github.com/itead/Sonoff_Devices_DIY_Tools/blob/master/SONOFF%20DIY%20MODE%20Protocol%20Doc%20v2.0%20Doc.pdf
Steps:
- Prepare your firmware you want to flash (for example from ESPHome)