Skip to content

Instantly share code, notes, and snippets.

/**
Useful links
https://wiki.wemos.cc/products:d1:d1_mini
https://cdn-images-1.medium.com/max/1400/1*YKc8KpAfMrlhrOLmNjdRwQ.png (D1 full pinout)
https://github.com/Jorgen-VikingGod/ESP8266-MFRC522
https://github.com/miguelbalboa/rfid
d1 mini rc52 wiring
https://discourse-cdn-sjc1.com/business5/uploads/mydevices/original/2X/e/ecedba79dc05f2c0b02b7fba8b3da2681590a11a.jpg
@alexey-bass
alexey-bass / compare.js
Created July 30, 2011 14:03
JavaScript version compare
/**
* Simply compares two string version values.
*
* Example:
* versionCompare('1.1', '1.2') => -1
* versionCompare('1.1', '1.1') => 0
* versionCompare('1.2', '1.1') => 1
* versionCompare('2.23.3', '2.22.3') => 1
*
* Returns:
@alexey-bass
alexey-bass / random-id.js
Last active January 5, 2024 00:07
Generate read-error-free hash. Similar letters absent (like 0 and O).
function randomString(length, chars) {
var result = '';
for (var i = length; i > 0; --i) {
result += chars[Math.round(Math.random() * (chars.length - 1))];
}
return result;
}
var dictionary = '';
dictionary+= 'ABCDEFGHKLMNPQRTWXYZ'; // IJOSUV
@alexey-bass
alexey-bass / dd-wrt.js
Last active October 13, 2021 09:46
Find DD-WRT router by criteria
/*
1. open page http://www.dd-wrt.com/wiki/index.php/Supported_Devices
2. open browser's console (in Google Chrome or Mozilla Firefox)
3. inject jQuery
4. tune your filter
5. run snippet
*/
// inject jQuery
(function() {
#include <SPI.h>
#include "mcp_can.h"
MCP_CAN CanBusShield(10); // Set CS pin: 10 for old, 9 for v1.2 and up
void setup() {
Serial.begin(500000);
Serial.println();
Serial.println();
@alexey-bass
alexey-bass / .gitconfig
Last active August 18, 2019 12:56
Collection of my Git aliases. Put in ~/.gitconfig
# First time setup - https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
# Line endings - https://help.github.com/en/articles/dealing-with-line-endings
# Learn branching - http://pcottle.github.com/learnGitBranching/
[user]
name = Alexey Bass
email = alexey.bass@liamg.moc
[color]
ui = true
@alexey-bass
alexey-bass / ddns-start.sh
Created May 9, 2019 20:27
noip.com ddns start custom script
#!/bin/sh
# https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS
# https://github.com/RMerl/asuswrt-merlin/wiki/DDNS-Sample-Scripts
# https://www.noip.com/integrate/request
USERNAME="alexey-bass"
PASSWORD="**********"
HOSTNAME="*****.ddns.net"
IP="$(curl -fs4 https://myip.dnsomatic.com/)"
@alexey-bass
alexey-bass / crawler.js
Last active October 30, 2018 13:19
Phantom Crawler
function log(msg) {
console.log(getTime()+ ': '+ msg);
}
function getTime() {
var d = new Date();
return pad(d.getHours()) +':'+ pad(d.getMinutes()) +':'+ pad(d.getSeconds()) +'.'+ rpad(d.getMilliseconds(), 3);
}
function pad(val, len) {
/**
To program lite version, choose
Generic ESP8266 Module, 80 Mhz, 40 Mhz, DOUT, 921600, 1M (512K SPIFFS), nodemcu, Disabled, None
DOUT and nodemcu!
*/
#include "ESP8266WiFi.h"
#include <Adafruit_NeoPixel.h>
X,Y,TYPE,SPEED,DIRTYPE,DIRECTION
34.760417,31.581683,1,90,1,180
34.7676,31.643283,1,90,1,180
34.772267,31.530583,1,90,1,180
34.783083,31.4988,1,90,1,0
34.7852,32.0356,1,90,1,270
34.786367,32.046667,1,90,1,90
34.810217,32.111433,1,90,1,0
34.818367,32.005,1,90,1,270
34.82015,32.16855,1,90,1,0