This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import board | |
import neopixel | |
import random | |
# The number of NeoPixels | |
num_pixels = 240 | |
# The order of the pixel colors - RGB or GRB. Some NeoPixels have red and green reversed! | |
# For RGBW NeoPixels, simply change the ORDER to RGBW or GRBW. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.bind(('', 5000)) | |
while True: | |
data, addr = sock.recvfrom(4096) | |
print('got packet: %s from $s' % data, addr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.sendto(b"Buy a copy of Chip War today!", ("130.64.80.187", 5000)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import board | |
import digitalio as dio | |
import time | |
led = dio.DigitalInOut(board.LED) | |
led.direction = dio.Direction.OUTPUT | |
button = dio.DigitalInOut(board.D6) | |
button.direction = dio.Direction.INPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo iwlist wlan0 scan essid Tufts_Secure | |
wlan0 Scan completed : | |
Cell 01 - Address: 70:DB:98:14:69:FF | |
Channel:52 | |
Frequency:5.26 GHz (Channel 52) | |
Quality=70/70 Signal level=-39 dBm | |
Encryption key:off | |
ESSID:"Tufts_Wireless" | |
Bit Rates:12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s; 48 Mb/s | |
54 Mb/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric import task | |
# Usage | |
# | |
# fab -H [email protected] --prompt-for-login-password deploy | |
@task | |
def deploy(c): | |
hostname = c.run('hostname', hide=True).stdout | |
print('\033[32;1mLogged into {0}\033[0m'.format(hostname)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cProfile | |
import pstats | |
from pysolar.solar import * | |
import datetime | |
import random | |
latitudes = random.sample(range(-90, 90), 100) | |
longitudes = random.sample(range(-180, 180), 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
import timeit | |
import time | |
@functools.lru_cache(maxsize=None) | |
def fib(n): | |
if n < 2: | |
return n | |
return fib(n-1) + fib(n-2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
WiFi Web Server LED Blink | |
A simple web server that lets you blink an LED via the web. | |
This sketch will print the IP address of your WiFi module (once connected) | |
to the Serial monitor. From there, you can open that address in a web browser |
NewerOlder