Skip to content

Instantly share code, notes, and snippets.

View dkarchmer's full-sized avatar

David Karchmer dkarchmer

View GitHub Profile
@dkarchmer
dkarchmer / Ubuntu19.10-DockerCompose.md
Last active January 19, 2023 10:59
Installing Docker Compose on Ubuntu to run from ECR docker repos

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 December 15, 2021 05:17
Windows 10 WSL Ubuntu Setup
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 March 2, 2021 01:13
Windows 10 Setup

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 October 30, 2019 17:07
Emacs .emacs.d/init.el file with Python configuration
;; .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 February 20, 2019 01:36
PODuino with multi-LED button
/* 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 February 8, 2019 02:01
Configuration Instructions for an IOTile Access Point

IOTile Access Point

Configuration Instructions

Requirements:

  • bled112 dongle on your machine
  • Create a Python virtual environment (Python 2.7 or 3.6)
  • Install:
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 January 31, 2019 18:59
IOTile Core Tools Tutorial

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 September 7, 2017 17:19
Serverless function snippet to return an S3 file
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 June 10, 2017 19:04
Python Script Template with logging and arguments
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__':