A simple case for my USB Sonoff programmer. The two half's are glued together and a 18mm piece of heat-shrink is used to protect the PCB.
Warning: Do not connect the mains supply to the relay board with the programmer connected!
In the Arduino IDE select the board as either Generic ESP8266 or ESP8285 (some relays use this chip)
To set the ESP8266 into programming mode.
Press and hold the push button on the Relay board (GPIO0).
Press and release the power button on the programmer.
Program the device and keep the relays push button pressed until done.
The default upload speed for the programmer is 921600, some boards work better with 115200.
Simple Sonoff Blink Sketch (for testing)