Skip to content

Instantly share code, notes, and snippets.

View sidwarkd's full-sized avatar
🌮
Smart Puck'in

Kevin Sidwar sidwarkd

🌮
Smart Puck'in
View GitHub Profile
@sidwarkd
sidwarkd / Dockerfile
Created September 30, 2021 03:15
Github Actions Example of Mult-Arch Docker Image Build for ESP32 Firmware Flashing
FROM debian:buster-slim
RUN apt update \
&& apt install -y build-essential gcc make libftdi-dev git\
&& git clone https://github.com/makercrew/ftx-prog.git /ftxprog \
&& cd /ftxprog \
&& make
FROM debian:buster-slim
COPY --from=0 /ftxprog/ftx_prog /ftxprog/
-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw
WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg
RW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cP
R5QUVTVXjJ6oojkZ9YI8QqlObvU7wy7bjcCwXPNZOOftz2nwWgsbvsCUJCWH+jdx
sxPnHKzhm+/b5DtFUkWWqcFTzjTIUu61ru2P3mBw4qVUq7ZtDpelQDRrK9O8Zutm
NHz6a4uPVymZ+DAXXbpyb/uBxa3Shlg9F8fnCbvxK/eG3MHacV3URuPMrSXBiLxg
@sidwarkd
sidwarkd / client1.py
Created March 25, 2020 03:30
Connecting Multiple Raspberry Pi Clients to a Raspberry Pi Server with Socket.IO
# Running on Raspberry Pi 1
import socketio
sio = socketio.Client()
def send_sensor_readings():
while True:
sio.emit('my_message', {'temp':75})
sio.sleep(5)
@sidwarkd
sidwarkd / code_complete.md
Last active April 23, 2020 20:55
Code Complete Notes

Code Complete Notes

Requirements

Before any requirements are drafted you MUST come up with a problem statement to help focus all future requirement discussions. "How does this relate to the problem definition.

Functional Requirements

  • Are all the inputs to the system specified, including their source, accuracy, range of values and frequency?
  • Are all the outputs from the system specified, including their destination, accuracy, range of values, frequency and format?
  • Are all output formats specified?
  • Are all the external hardware and software interfaces specified?
@sidwarkd
sidwarkd / Dockerfile_particle_firmware
Created February 25, 2018 06:57
Dockerfile for a debian-based image to build particle firmware locally
# Base Image
FROM debian
# Install Dependencies
RUN ["/bin/sh","-c","\
dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y \
libc6:i386 \
libncurses5:i386 \
@sidwarkd
sidwarkd / bmp2header.py
Last active February 27, 2024 14:51
A simple script to convert a bmp file to a header file for the GDEP015OC1 e-paper display
#!/usr/bin/env python
# You need to install Pillow for this script to work
# pip install Pillow
import argparse
from PIL import Image
# Currently this utility script is very specific to my needs for generating
# a header file from a 200x200 pixel bmp. It could easily be expanded to work
@sidwarkd
sidwarkd / README.md
Last active June 4, 2018 02:56
Lambda Functions for the NHL Score Twitter Bot

Need to locally install all dependencies with pip install [package] -t ./ so they can be packaged before uploading to AWS. The packages need to be created in their own folders and the filenames changed to lambda_function.py.

Requirements

  • The nhl package is required for get_nhl_game_brief
@sidwarkd
sidwarkd / deep_sleep.ino
Created December 14, 2017 20:12
Sleep Examples for Particle Photon
void setup() {
Serial.begin(9600);
Serial.println("Running setup code");
}
void loop() {
// Do some stuff here like read a sensor
Serial.println("Start sensor read");
delay(3000);
Serial.println("End sensor read");
@sidwarkd
sidwarkd / ADS1115.py
Last active August 2, 2019 10:45
Pycom class for interacting with the ADS1115 ADC
import ustruct
import time
_REGISTER_MASK = const(0x03)
_REGISTER_CONVERT = const(0x00)
_REGISTER_CONFIG = const(0x01)
_REGISTER_LOWTHRESH = const(0x02)
_REGISTER_HITHRESH = const(0x03)
@sidwarkd
sidwarkd / shell_commands.txt
Created September 5, 2017 03:28
Install Docker on the Pi and run at startup
curl -sSL https://get.docker.com | sh
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker pi
# Log out and back in to use docker commands