Skip to content

Instantly share code, notes, and snippets.

Avatar

David Karchmer dkarchmer

View GitHub Profile
@dkarchmer
dkarchmer / Ubuntu19.10-DockerCompose.md
Last active Aug 17, 2020
Installing Docker Compose on Ubuntu to run from ECR docker repos
View Ubuntu19.10-DockerCompose.md

Ubuntu 19.10 with Docker Compose

Installing Ubuntu 19.10 with latest docker, docker-compose.

Install Ubuntu

Install latest Ubuntu 19.10 and then upgrade to latest

sudo apt-get update
@dkarchmer
dkarchmer / WSL2-Ubuntu.txt
Last active Dec 15, 2021
Windows 10 WSL Ubuntu Setup
View WSL2-Ubuntu.txt
sudo apt-get update
sudo apt-get upgrade
# Store Github credentials
git config --global credential.helper store
git clone ...
# Install Python
sudo apt-get install -y python
sudo apt-get install python3.8
@dkarchmer
dkarchmer / windows10.md
Last active Mar 2, 2021
Windows 10 Setup
View windows10.md

Install

  • Docker for Windows
  • Visual Studio Code (or IDE of choice), but VSCode supports WSL2 very well.
  • Github Desktop (optional)
  • Evernote (Personal)
  • Slack App, Notion App, Twist App (optional)
  • Chrome and/or Firefox and set as default

Choco should be used to manage packages

@dkarchmer
dkarchmer / init.el
Created Oct 30, 2019
Emacs .emacs.d/init.el file with Python configuration
View init.el
;; .emacs.d/init.el
;; ===================================
;; MELPA Package Support
;; ===================================
;; Enables basic packaging support
(require 'package)
;; Adds the Melpa archive to the list of available repositories
(add-to-list 'package-archives
@dkarchmer
dkarchmer / 8kbuttons.ino
Last active Feb 20, 2019
PODuino with multi-LED button
View 8kbuttons.ino
/* This project implements a multi-color (LED) button with the following specification:
*
* - Button starts as off, representing everything is good
* - A click changes the button to green and represents a request to start filling up a new order
* - The warehouse control can send a "receive" event, which turns color to light blue
* - Clicking button for more than 3sec resets button to off
* - Double click sets the button to red
*
*/
@dkarchmer
dkarchmer / AccessPointReadme.md
Last active Feb 8, 2019
Configuration Instructions for an IOTile Access Point
View AccessPointReadme.md

IOTile Access Point

Configuration Instructions

Requirements:

  • bled112 dongle on your machine
  • Create a Python virtual environment (Python 2.7 or 3.6)
  • Install:
View iotile-scan-example.py
import argparse
import time
import sys
from iotile.core.hw import HardwareManager
def build_parser():
parser = argparse.ArgumentParser(description="Print broadcast readings from a specific device")
parser.add_argument('-d', '--dev', type=lambda x: int(x, 0), help="Optional, the UUID of the device you want to see broadcasts from (0x21 for example)")
parser.add_argument('-i', '--interval', type=float, default=1.0, help="The minimum interval in seconds between two reported readings (only applies when -d is given), defaults to 1s")
@dkarchmer
dkarchmer / iotile_coretools_tutorial.md
Last active Jan 31, 2019
IOTile Core Tools Tutorial
View iotile_coretools_tutorial.md

IOTile Core Tools

Basics

The public facing documentation for the IOTile Core Tools is https://coretools.readthedocs.io/en/latest/introduction.html, but things change a little when you have access to a real device.

With a BLED112 dongle, and access to the proper packages, you can communicate with a real device.

After installation, the iotile operations can be run from the OS command-line, or by using the IOTile Shell.

@dkarchmer
dkarchmer / serverless_get_s3_file.py
Created Sep 7, 2017
Serverless function snippet to return an S3 file
View serverless_get_s3_file.py
def get(event, context):
response = _get_error_responce('Incorrect URL format: Use /foobar/<a>/<b>/?type=<url/file>')
if 'queryStringParameters' in event and 'pathParameters' in event:
if event['pathParameters'] and 'a' in event['pathParameters'] and 'b' in event['pathParameters']:
a = event['pathParameters']['a']
b = event['pathParameters']['b']
@dkarchmer
dkarchmer / python-script-template.py
Created Jun 10, 2017
Python Script Template with logging and arguments
View python-script-template.py
import sys
import os
import argparse
import getpass
import logging
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logger = logging.getLogger('upload_bom')
if __name__ == '__main__':