Skip to content

Instantly share code, notes, and snippets.

@SimplyAhmazing
SimplyAhmazing / sm1.py
Created April 24, 2017 14:23
Sample Smart Modules Protocol
from opentrons import robot, instruments, containers
from opentrons import smart_module
md = smart_module.MagDeck()
md.connect('/dev/tty123')
sh = smart_module.Shaker()
sh.connect('/dev/tty124')

API Builders script source,

import json
import os
import random
import sys
import subprocess
import time
@SimplyAhmazing
SimplyAhmazing / docker.md
Last active December 15, 2016 17:58
Docker ProTips
  • First things first, install VirtualBox
  • Use docker-machine to provision "default" docker VM (no longer use boot2docke, ever!)

Enable port forwarding on your VM,

for i in {10000..10999}; do
    VBoxManage modifyvm "default" --natpf1 "tcp-port$i,tcp,,$i,,$i";
    VBoxManage modifyvm "default" --natpf1 "udp-port$i,udp,,$i,,$i";
done
------------------------------ MAC BUILDS ------------------------------
Build #1
https://s3.amazonaws.com/ot-app-builds/mac/OpenTrons-v1.99.99-Darwin64_2016-11-07_19.09_20161104-170000-fix-windows-integration-test_e9e2bca5fd.zip
--------------------------------------------------------------------------------
Build #2
https://s3.amazonaws.com/ot-app-builds/mac/OpenTrons-v1.99.99-Darwin64_2016-11-07_18.42_20161106-adding-linux-support_9eeddd6b03.zip
--------------------------------------------------------------------------------
Build #3
https://s3.amazonaws.com/ot-app-builds/mac/OpenTrons-v1.99.99-Darwin64_2016-11-07_18.33_20161104-170000-fix-windows-integration-test_e56124f857.zip
--------------------------------------------------------------------------------
@SimplyAhmazing
SimplyAhmazing / list-ot-builds.py
Created November 10, 2016 16:05
get latest n builds from ot-app-builds
import os
import boto
import boto.s3.connection
access_key = os.environ.get('AWS_ACCESS_KEY_ID')
secret_key = os.environ.get('AWS_SECRET_ACCESS_KEY')
import copy
from pprint import pprint as pp
def Memento(obj, deep=False):
state = (copy.copy, copy.deepcopy)[bool(deep)](obj.__dict__)
def Restore():
obj.__dict__.clear()
obj.__dict__.update(state)

Below is a class decorator did_you_mean that will, when applied to a class, catch undefined methods on that class and return y ou a recommendation of methods to call instead.

from fuzzywuzzy.process import extractOne


def get_class_methods(cls_instance):
    return [name for name in dir(cls_instance) if not name.startswith('__')]
from opentrons_sdk.labware import containers, instruments
# Deck declarations
"""
Deck is a singleton behind the scenes that registers containers
and validates errors such as impromper allocation and inferences
loading of yaml/json files based on attribute names.
"""
protocol = Protocol()
import asyncio
import multiprocessing
import os
from concurrent.futures import ThreadPoolExecutor
@asyncio.coroutine
def coro_get(q):
loop = asyncio.get_event_loop()
@SimplyAhmazing
SimplyAhmazing / gist:3eb2089ff1c04e58e789
Last active August 29, 2015 14:10
Solution for Code Kata # 18
import collections
from pprint import pformat
{
'A': ['B', 'C'],
'B': ['C', 'E'],
}
class Dependencies(object):