Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@spapadim
spapadim / fetchWindowVars.js
Last active April 19, 2020 14:43
Async function that fetches window variables into a Chrome content script (or another scope, in general).
// Based on https://stackoverflow.com/a/55431653/13321349
function fetchWindowVarsPromise(varNames, wnd = undefined) {
wnd = wnd || window;
return new Promise((resolve, reject) => {
// Generate random ID, to prevent other code from easily sending fake values
const randomId = uuid4();
// Register self-removing message handler first
const _messageHandler = (event) => {
console.log("DBG fetch vars:", event)
@spapadim
spapadim / settings.htm
Last active September 24, 2015 13:34
Code for css-html-js-minify bug report
<html>
<head>
<title>ESPClock Settings</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
</head>
<body>
<nav class="navbar navbar-fixed-top navbar-inverse">
@spapadim
spapadim / eagle.app.v6.common.ld.diff
Last active September 15, 2015 11:28
Diffs on installed Arduino, to compile ucglib port
--- tools/sdk/ld/eagle.app.v6.common.ld.orig 2015-09-13 11:05:37.742179473 -0400
+++ tools/sdk/ld/eagle.app.v6.common.ld 2015-09-13 11:06:26.086178894 -0400
@@ -155,7 +155,7 @@
*.cpp.o(.literal*, .text*)
*libm.a:(.literal .text .literal.* .text.*)
*libsmartconfig.a:(.literal .text .literal.* .text.*)
- *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
+ *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text .irom.text.*)
_irom0_text_end = ABSOLUTE(.);
_flash_code_end = ABSOLUTE(.);
index start-time end-time event? event-type data
0 -33.00 μs -33.00 μs true START
1 -23.00 μs 141.00 μs false O
2 152.00 μs 152.00 μs true ACK
3 161.00 μs 325.00 μs false ÿ
4 336.00 μs 336.00 μs true ACK
5 345.00 μs 511.00 μs false Ü
6 522.00 μs 522.00 μs true NACK
7 560.00 μs 560.00 μs true STOP
8 589.00 μs 589.00 μs true START
@spapadim
spapadim / protocol.txt
Created August 27, 2015 15:42
I2C slave read capture (SDA stuck?)
"index","start-time","end-time","event?","event-type","data"
"0","-48.00 μs","-48.00 μs","true","START",""
"1","-27.00 μs","187.00 μs","false","","N"
"2","204.00 μs","204.00 μs","true","ACK",""
"3","220.00 μs","429.00 μs","false","","R"
"4","442.00 μs","442.00 μs","true","ACK",""
"5","456.00 μs","665.00 μs","false","","P"
"6","678.00 μs","678.00 μs","true","ACK",""
"7","692.00 μs","901.00 μs","false","","N"
"8","914.00 μs","914.00 μs","true","ACK",""
@spapadim
spapadim / Color.cpp
Created August 27, 2015 03:50
ESP8266 cross-linked object initialization
#include "Color.h"
Color WHITE(0xff, 0xff, 0xff);
@spapadim
spapadim / serial-solidoodle.log
Created July 31, 2015 03:32
serial-solidoodle.log
2015-07-30 14:45:37,214 - SERIAL - DEBUG - Enabling serial logging
2015-07-30 14:45:42,350 - SERIAL - DEBUG - Connecting to: /dev/ttyUSB0
2015-07-30 14:45:42,397 - SERIAL - DEBUG - Changing monitoring state from 'Offline' to 'Opening serial port'
2015-07-30 14:45:42,890 - SERIAL - DEBUG - Connected to: Serial<id=0x2a52690, open=True>(port='/dev/ttyUSB0', baudrate=250000, bytesize=8, parity='N', stopbits=1, timeout=30.0, xonxoff=False, rtscts=False, dsrdtr=False), starting monitor
2015-07-30 14:45:42,894 - SERIAL - DEBUG - Changing monitoring state from 'Opening serial port' to 'Connecting'
2015-07-30 14:45:50,278 - SERIAL - DEBUG - Recv: ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@