Skip to content

Instantly share code, notes, and snippets.

import socket
def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
# doesn't even have to be reachable
s.connect(('1.2.3.4', 1))
my_ip_addr = s.getsockname()[0]
except:
my_ip_addr = '127.0.0.1'
import time
import sys
import signal
from PyMata.pymata import PyMata
SERVO_MOTOR = 5 # servo attached to this pin
# create a PyMata instance
#!/usr/bin/env python3
import asyncio
import serial
class ArduinoSerial():
def __init__(self):
"""
Open the serial port at 57600
@MrYsLab
MrYsLab / wss_server.js
Created April 9, 2015 13:43
Scratch wss server example
/* I used this web page as a basis: http://www.chovy.com/web-development/self-signed-certs-with-secure-websockets-in-node-js/
1. I created the key and cert using the instructions.
2. I created a modified secure websocket server - included below
3. I created a simplified Scratch extension - included below.
4. I added the cert to firefox using the instructions in the article for Chrome. This worked
5. I tried to add the cert to chrome by accessing https://0.0.0.0:1234, but this brought me to a search page.
6. I then created a pkc12 cert and used the settings to add it to chrome, but could not get a wss connection.
Bottom line - I got Firefox to work, but not chrome
@MrYsLab
MrYsLab / blink_updated.py
Created March 27, 2015 12:13
Updated blink script with firmata reset at the end