Skip to content

Instantly share code, notes, and snippets.

@rothnic
rothnic / mqttcomm.py
Created September 20, 2023 19:23
cassandra mqtt connection test
import logging
logger = logging.getLogger(__name__)
import time
import json
import paho.mqtt.client as mqtt
import pandas as pd
import random
from src.backend.data import datatodf, roverdata, mapdata
@rothnic
rothnic / default___settings.json
Last active October 31, 2018 04:18
Golem Docker-Compose Example - Selenium Grid - Headless Firefox and Chrome Device Configs
{
"remote_browsers": {
"chrome_remote_desktop_headless": {
"goog:chromeOptions": {
"args": ["--headless", "--disable-gpu", "--window-size=1366,768"]
},
"platform": "ANY",
"browserName": "chrome"
},
"chrome_remote_mobile_headless": {
@rothnic
rothnic / docker-compose.yml
Created April 7, 2017 11:14
Native Spark Cluster on Docker with Jupyter Notebook and PySpark
master:
image: jupyter/pyspark-notebook
command: bash -c "/usr/local/spark/bin/spark-class org.apache.spark.deploy.master.Master -h master && \
start-notebook.sh"
hostname: master
environment:
MASTER: spark://master:7077
SPARK_CONF_DIR: /conf
SPARK_PUBLIC_DNS: localhost
expose:
@rothnic
rothnic / dask_slow_bag_conda_env.txt
Last active February 9, 2017 17:47
Stacktrace when killing a slow read_text command on s3 files with dask.
→ conda list
# packages in environment at /Users/nroth/anaconda/envs/dask:
#
appnope 0.1.0 py36_0 defaults
bokeh 0.12.4 py36_0 defaults
boto3 1.4.3 py36_0 defaults
botocore 1.4.90 py36_0 defaults
chest 0.2.3 py36_0 defaults
cloudpickle 0.2.2 py36_0 defaults
cycler 0.10.0 py36_0 defaults
@rothnic
rothnic / Uncertainties.py
Created August 30, 2016 04:50
Modeling and Simulation Uncertainty Distribution
__author__ = 'Nick'
import os
from openmdao.main.api import Component
from openmdao.lib.datatypes.api import Float
import pandas as pd
from calc_uncertainties import Distribution
from Common.AttributeTools.io import get_outputs
@rothnic
rothnic / dynamic_plot_example.py
Last active May 20, 2019 13:34
Example Bokeh app that swaps axis and range out dynamically
from bokeh.models import GlyphRenderer, ColumnDataSource
from bokeh.models.plots import Plot
from bokeh.models import Circle, Range1d, LinearAxis, CategoricalAxis, Axis, FactorRange
from bokeh.models.widgets import HBox, VBoxForm, Select
from bokeh.io import curdoc
data = {'a': [1, 2, 3, 4],
'b': [3, 5, 4, 5],
'c': ['foo', 'bar', 'foo', 'bar']}
@rothnic
rothnic / watch_examples.py
Created December 10, 2015 18:21
Refresh chart examples when chart source or chart example is modified
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
import os
import subprocess
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
CHARTS = {
@rothnic
rothnic / chart_app_new_server.py
Last active June 4, 2016 11:49
Example interactive app with bokeh charts and new server refactor
from bokeh.models.widgets import HBox, VBoxForm, Select
from bokeh.charts import Bar
from bokeh.io import curdoc
data = {'a': [1, 2, 3, 4],
'b': [3, 5, 4, 5],
'c': ['foo', 'bar', 'foo', 'bar']}
col_names = list(data.keys())
@rothnic
rothnic / line_palette.py
Created November 4, 2015 19:07
bokeh line with custom palette
from bokeh.charts import Line, show, output_file, color
# build a dataset where multiple columns measure the same thing
data = dict(python=[2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120, 111],
pypy=[12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110, 130],
jython=[22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139, 160],
test=['foo', 'bar', 'foo', 'bar', 'foo', 'bar', 'foo', 'bar', 'foo', 'bar',
'foo', 'bar', 'foo', 'bar']
)
@rothnic
rothnic / chart_app.py
Created October 23, 2015 15:10
Prototype Interactive Bokeh Chart
from bokeh.models import Plot, ColumnDataSource, GlyphRenderer
from bokeh.properties import Instance, Dict, String, Any
from bokeh.server.app import bokeh_app
from bokeh.server.utils.plugins import object_page
from bokeh.models.widgets import HBox, TextInput, VBoxForm, Select
from bokeh.charts import Bar
class ChartApp(HBox):
"""An example of a browser-based, interactive plot with column selection controls."""