Skip to content

Instantly share code, notes, and snippets.

#include <WiFi.h>
#include <HTTPClient.h>
const char *ssid = ""; // Your WiFi SSID
const char *password = ""; // Your WiFi password
/**
* If WiFi is connected, the ESP32 will use ADC2 pins (25, 26, 27, 14, 12, 13, 4, 2, 15) for WiFi.
* We must not use ADC2 pins for anything else.
* ADC1 INPUT ONLY: 34, 35, *36, 39
* ADC1 INPUT / OUTPUT: *32, 33
@MrCoder
MrCoder / FpeBouncyCastle.java
Created March 16, 2023 04:45
FPE in Java with BouncyCastle
package org.example;
import org.bouncycastle.crypto.AlphabetMapper;
import org.bouncycastle.crypto.util.BasicAlphabetMapper;
import org.bouncycastle.jcajce.spec.FPEParameterSpec;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
@MrCoder
MrCoder / build.gradle
Last active August 14, 2021 02:18
[buildSearchableOptions throws exception in CI build] https://github.com/JetBrains/gradle-intellij-plugin/issues/738 We have to disable this task in build.gradle.
apply plugin: 'org.jetbrains.intellij'
// Disable all Gradle Tasks for the gradle-intellij-plugin as we only use the plugin for the dependencies
buildPlugin.enabled = false
buildSearchableOptions.enabled = false // we only need to disable this one
jarSearchableOptions.enabled = false
patchPluginXml.enabled = false
prepareSandbox.enabled = false
prepareTestingSandbox.enabled = false
prepareUiTestingSandbox.enabled = false
vertical-align: middle
http://phrogz.net/css/vertical-align/index.html
`vertical-align` can only be used on `table-cell` (such as td or elements with display: table-cell) and inline elements
(such as img or span with display:inline-block).
<div style="display:table-cell; vertical-align:middle"> ... </div>
<img align="middle" ...>
<img style="vertical-align:middle" ...>
@MrCoder
MrCoder / commands
Last active January 27, 2021 05:03
Test remote port with and without telnet
# bash: It requires no other tools
# cat < /dev/tcp/host/port or cat < /dev/udp/host/port
$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
# telnet: telnet host port
$ telnet 127.0.0.1 22
# nc: nc -zv host port1 port2 or port3-port4
$ nc -zv 127.0.0.1 22
@MrCoder
MrCoder / Second-cat.seq
Last active January 26, 2021 21:23
[cat strategy] cat teaching design pattern strategy #designpattern
Second.cat() {
card.active()
}
@MrCoder
MrCoder / useful-regular-expressions.md
Last active January 15, 2020 05:16
Useful regular exppressions

Replace continuous change lines (0x0A) with a single change line char

  1. simple case: \n+ -> \n
  2. remove space chars except for those on the last lin: (\n)[\n\s]*\n(\s*) -> $1$2
@MrCoder
MrCoder / iterm2-solarized.md
Created January 13, 2020 00:19 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@MrCoder
MrCoder / service-worker.md
Last active October 11, 2019 10:01
My (mis)understanding of service worker

Service workers intercept all network connections

There is one Service worker for one tab

There is one service worker for one tab, if you open two tabs for the same site, there will be two service workers.

Misunderstanding

Servicer workers are generated with some tools and not hand-written

Keybase proof

I hereby claim:

  • I am mrcoder on github.
  • I am deardog (https://keybase.io/deardog) on keybase.
  • I have a public key ASDMBmVFd3tUqM59DS2idccsQZSMG5BSJ6XneUax4u5OjAo

To claim this, I am signing this object: