Skip to content

Instantly share code, notes, and snippets.

View Natim's full-sized avatar
🏠
Working from home

Rémy HUBSCHER Natim

🏠
Working from home
  • Silvr
  • Rennes
  • 16:28 (UTC +02:00)
  • X @Natim
View GitHub Profile
@Lothiraldan
Lothiraldan / udp_listener.py
Created October 25, 2012 10:06
Multiple UDP listener on the same port
import socket
# Socket part
ANY = "0.0.0.0"
MCAST_ADDR = "237.252.249.227"
MCAST_PORT = 1600
#create a UDP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
#allow multiple sockets to use the same PORT number
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
@nferrari
nferrari / alwaysdata_api_mailbox_patch
Created November 19, 2012 13:58
PATCH a mailbox through alwaysdata API
import json
import requests
API_URL = 'https://api.alwaysdata.com/v1/'
API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
ACCOUNT_NAME = 'account_name'
# Updating a mailbox
mailbox_id = 12345
>>> from cryptography import x509
>>> from cryptography.hazmat.backends import default_backend
>>> from cryptography.hazmat.primitives import hashes
>>> cert_pem = open( '/tmp/testcert.crt', 'rb' ).read()
>>> cert = x509.load_pem_x509_certificate(cert_pem, default_backend())
>>> print(cert.public_key())
<cryptography.hazmat.backends.openssl.ec._EllipticCurvePublicKey object at 0x7fe27d803450>
@Ashton-W
Ashton-W / Issue.md
Last active June 14, 2024 15:27
GitHub Markdown toggle code block
Click to toggle contents of `code`
CODE!