Skip to content

Instantly share code, notes, and snippets.

View ccooper21's full-sized avatar

Christopher Cooper ccooper21

View GitHub Profile
@ccooper21
ccooper21 / Vagrantfile
Created November 19, 2019 05:36
This is a Vagrant virtual machine definition and corresponding provisioning script for an ESP32 development environment using the ESP-IDF.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--usb", "on"]
vb.customize ["modifyvm", :id, "--usbehci", "on"]
vb.customize ["modifyvm", :id, "--usbxhci", "on"]
@ccooper21
ccooper21 / websocket_client_handshake_test_awsiot.py
Created November 10, 2017 08:35
These scripts validate the websocket client handshake functionality described in RFC6455 and provided by MicroPython's "websocket_helper".
# This script validates the websocket client handshake functionality, described in RFC6455 and provided by MicroPython's
# "websocket_helper" module, against the websocket endpoint for AWS' IoT MQTT-based service. For more information about
# this service, see https://aws.amazon.com/iot-platform/. Two key considerations with respect to integrating with AWS'
# service is that AWS requires the use of TLS/SSL (i.e. HTTPS) and the use of a cryptographically sound authentication
# mechanism. While AWS supports several authentication mechanisms, this script uses the AWS SigV4 digital signature
# mechanism described at http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html and incorporates code
# based on the associated SigV4 Python-based example code.
#
# For this script to succeed, the changes included in pull request #3420 must be applied (see
# https://github.com/micropython/micropython/pull/3420). Further, the following keys in this script must be replaced
@ccooper21
ccooper21 / mqtt_websocket_example.py
Created October 16, 2017 00:17
Example MicroPython MQTT over WebSocket script
# This example script requires the MicroPython changes in the following branches:
#
# https://github.com/ccooper21/micropython/tree/websocket-client-support
# https://github.com/ccooper21/micropython-lib/tree/umqtt.simple-websocket-support
import usocket as socket
import utime as time
from websocket import websocket
from umqtt.simple import MQTTClient
@ccooper21
ccooper21 / setup-aws.sh
Last active November 8, 2021 20:39
This is a bash shell script for bootstrapping the Hyperledger Fabric development environment on an AWS Ubuntu AMI instance. It has been tested with Ubuntu v14.04 (AMI ID ami-2d39803a). While I wrote this to enable AWS deployments, this script should be usable in any Ubuntu based environment. See the first comment below for the detailed background.
#!/bin/bash
# Install "git"
sudo apt-get update
sudo apt-get -y install git
# Clone the Hyperledger Fabric base image repository. It would be preferable
# to use the "/tmp" directory as the destination, since this repository is no
# longer needed once the base image has been built. However, this is
# problematic because one of the scripts that builds the base image removes
@ccooper21
ccooper21 / amazon-linux-omnibus.erb
Last active December 10, 2015 13:09
This is a Chef bootstrap script for bootstrapping the Chef client on an Amazon Linux AMI instance. It has been tested with Amazon Linux v2012.09 (AMI ID ami-1624987f). See the first comment below for the detailed background.
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
exists() {
if command -v $1 &>/dev/null
then
return 0
else
return 1