Skip to content

Instantly share code, notes, and snippets.

@zed
zed / external_ip.py
Created April 4, 2020 16:16
Get external/public ip using DNS, HTTP, STUN protocols
#!/usr/bin/env python3
"""Get external ip using DNS, HTTP, STUN protocols.
Print the first result (the fastest).
Usage:
$ python3 -m external_ip [--quiet]
Optional dependencies:
$ python3 -m pip install aidns pynat pystun3
#!/usr/bin/env python3
"""
https://www.youtube.com/watch?v=BleOgPhsdfc
"""
from dataclasses import dataclass
@dataclass
class RedLightViolation:
"""..."""
@zed
zed / ping_pong.c
Last active January 30, 2023 07:05
Native messaging "ping_pong" example in C
/*** Native messaging "ping_pong" example in C.
*
* It is reimplementation of the corresponding Python example from
* https://github.com/mdn/webextensions-examples/tree/master/native-messaging
*
* # Python 3.x version
* # Read a message from stdin and decode it.
* def getMessage():
* rawLength = sys.stdin.buffer.read(4)
* if len(rawLength) == 0:
@zed
zed / README.md
Last active March 18, 2024 06:27
Min-swap palindrome

To run application

./app.py

To make request to it

@zed
zed / .gitignore
Last active March 18, 2024 18:02
Receive udp messages and write summary info to file
/stats.json