Skip to content

Instantly share code, notes, and snippets.

###############################################3
# Get MAC Address using Micropython
# Where network_setup.sta_if is the lan object
# See https://stackoverflow.com/questions/71902740/how-to-retrieve-and-format-wifi-mac-address-in-micropython-on-esp32
###############################################3
import ubinascii
import network_setup
print(ubinascii.hexlify(network_setup.sta_if.config('mac'),':').decode().upper())
@jouellnyc
jouellnyc / gist:f016fbe638d2beff33d8b4ad2fb9b36d
Last active May 21, 2025 01:47
Micropython ssd1306 1.3 inch oled
"""
The 1.3" I2C 128x64 OLED will use sh1106 and NOT ssd1306 drivers:
i.e https://www.amazon.com/HiLetgo-SSH1106-SSD1306-Display-Arduino/dp/B01MRR4LVE?th=1
The .96" I2C 128x64 OLED will use ssd1306 drivers:
i.e https://www.amazon.com/DIYmall-Serial-128x64-Display-Arduino/dp/B00O2KDQBE?th=1
"""
from machine import Pin, I2C
oled_width = 128
oled_height = 64
@jouellnyc
jouellnyc / gist:b11833c07371a8986439e3c50b2e7861
Created June 13, 2024 02:20
How to get free space of internal file system - micropython
# Credit https://forum.micropython.org/viewtopic.php?f=16&t=2361&start=10
import uos
fs_stat = uos.statvfs('/')
fs_size = fs_stat[0] * fs_stat[2]
fs_free = fs_stat[0] * fs_stat[3]
print("File System Size {:,} - Free Space {:,}".format(fs_size, fs_free))
@jouellnyc
jouellnyc / gist:ea6eb67616b37dd95202420739756d5b
Last active August 13, 2020 04:04
Show all unique destination ports in Suricata's eve.json log
#cd /var/log/suricata
#cat eve.json | jq -r '.dest_port' | sort | uniq -c | sort -nr | head
436 53
410 443
215 null
193 80
28 22
22 5353
15 1900
6 5228
@jouellnyc
jouellnyc / gist:401bf422e44633d7878333855f1a84e3
Last active March 25, 2019 21:32
3 Interfaces on Raspberry PI 3B+
cat /etc/network/interfaces
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
### Keybase proof
I hereby claim:
* I am jouellnyc on github.
* I am jouellnyc (https://keybase.io/jouellnyc) on keybase.
* I have a public key whose fingerprint is 0763 D155 5A7E C1E0 EF47 B975 433D 4AB3 2446 852A
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am modulusmath on github.
  • I am modulusmath (https://keybase.io/modulusmath) on keybase.
  • I have a public key whose fingerprint is EDE0 F23D F43D 7B48 4B69 FF3A 0EFE 18B7 6CEA 4A08

To claim this, I am signing this object: