Skip to content

Instantly share code, notes, and snippets.

Avatar

Wojtek Kaniewski wojtekka

View GitHub Profile
@wojtekka
wojtekka / index.html
Last active Oct 21, 2020
Simple WebSocket console, self-contained, desktop/mobile, Firefox/Chrome, public domain
View index.html
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />
<script type="text/javascript">
var url = "ws://" + location.host + location.pathname + "websocket";
var connected = false;
var ws;
var ready = false;
@wojtekka
wojtekka / am2320.py
Created Apr 15, 2019
Simple code to read AM2320 connected to Raspberry Pi in Python without external libraries
View am2320.py
# AM2320 connected to Raspberry Pi pin 3 (SDA) and 5 (SCL)
# Public domain
import sys
import fcntl
import time
import struct
I2C_SLAVE = 0x0703
AM2320_ADDR = 0x5c
View gist:3c5197daefc631b3ed10b2ce1d03700a
$ openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key
@wojtekka
wojtekka / gist:6c532afa9437c9b6696e789caa6ecf4a
Last active Sep 19, 2018
Raspberry Pi Zero USB network with DHCP server
View gist:6c532afa9437c9b6696e789caa6ecf4a
#!/bin/sh
echo "dwc2" >> /etc/modules
echo "g_ether" >> /etc/modules
echo "dtoverlay=dwc2" >> /boot/config.txt
cat > /etc/systemd/network/usb0.network << EOF
[Match]
Name=usb0
You can’t perform that action at this time.