Skip to content

Instantly share code, notes, and snippets.

View tacaswell's full-sized avatar

Thomas A Caswell tacaswell

View GitHub Profile
@tacaswell
tacaswell / parse.py
Last active March 22, 2017 01:53
playing with dbd + parsimonious
from parsimonious.grammar import Grammar, NodeVisitor
grammar = Grammar(r"""
dbd = (comment / cimport / field / menu / record_type / variable / device / include / registrar / function / driver / "\n")+
field = _ "field(" f_name "," _ f_type ")" _ "{" (fp / "\n" )* _ "}"
f_name = ~"[A-Z0-9_]+"
f_type = "DBF_STRING" / "DBF_CHAR" / "DBF_UCHAR" / "DBF_SHORT" / "DBF_USHORT" / "DBF_LONG" / "DBF_ULONG" / "DBF_FLOAT" / "DBF_DOUBLE" / "DBF_ENUM" / "DBF_MENU" / "DBF_DEVICE" / "DBF_INLINK" / "DBF_OUTLINK" / "DBF_FWDLINK" / "DBF_NOACCESS"
fp = _ (prompt / special / size / promptgroup / g_field / comment / extra / "\n")
prompt = "prompt(" prompt_val ")\n"

Keybase proof

I hereby claim:

  • I am tacaswell on github.
  • I am tacaswell (https://keybase.io/tacaswell) on keybase.
  • I have a public key whose fingerprint is AC47 F71D B275 ECD0 B3DA 46E8 57FA 4540 DD4E FCF7

To claim this, I am signing this object:

@tacaswell
tacaswell / PLOTCON
Last active November 17, 2016 13:51
plotcon talk
Talk preseted at PLOTCON 2016
This gist contains
- static images
- the Jupyter notebook of the talk
[{"msg_id": "509F1C6775C44AF384D1BB09CC5C98A1", "content": {"data": {"value": false, "type": "supports_binary", "figure_id": "c29dac6a-5023-4ec4-b3d2-eb65f7ed72d9"}, "comm_id": "9ef138a80d974de58552b2cd1a092596"}, "buffers": [], "header": {"msg_id": "509F1C6775C44AF384D1BB09CC5C98A1", "session": "808538C89BCA4E9D8596C65C2D800DBE", "msg_type": "comm_msg", "date": "2016-10-08T12:17:56.831445", "version": "5.0", "username": "username"}, "parent_header": {}, "msg_type": "comm_msg", "metadata": {}}, {"msg_id": "B11E659698DE4EBC83A5B6A02C5C69B5", "content": {"data": {"type": "send_image_mode", "figure_id": "c29dac6a-5023-4ec4-b3d2-eb65f7ed72d9"}, "comm_id": "9ef138a80d974de58552b2cd1a092596"}, "buffers": [], "header": {"msg_id": "B11E659698DE4EBC83A5B6A02C5C69B5", "session": "808538C89BCA4E9D8596C65C2D800DBE", "msg_type": "comm_msg", "date": "2016-10-08T12:17:56.835025", "version": "5.0", "username": "username"}, "parent_header": {}, "msg_type": "comm_msg", "metadata": {}}, {"msg_id": "17212AB19B6B4C9382156985A6DC
  • [ ] do not touch root conda env!!!
  • [ ] From the comfort of your office:
    • [ ] scp make_the_env target_machine:~/
    • [ ] scp daq target_machine:~/
    • [ ] ssh target_machine
    • [ ] sudo ./make_the_env extra pkgs
    • [ ] sudo cp daq /usr/bin
    • [ ] sudo chmod a+rx /usr/bin/daq
  • [ ] go teach them about daq
@tacaswell
tacaswell / scanExamples.py
Created July 17, 2016 14:39 — forked from mlub/scanExamples.py
Loops over examples on the matplotlib1.5.1 page and opens the 1.5.1 and 2.0 version in a browser
#!/usr/bin/env python
import requests
import subprocess
from lxml import html
old_url = 'http://matplotlib.org/1.5.1/examples/'
new_url = 'http://matplotlib.org/2.0.0b2/examples/'
# Skip any urls containing these strings
skip_these = ['animation/', 'api/']
@tacaswell
tacaswell / condalog.sh
Created July 1, 2016 22:43 — forked from ericdill/condalog.sh
replace conda with condalog to get pass through behavior
#! /bin/bash
LOGBOOK=bs-testing
pkg_list_base="/tmp/automated-list-of-conda-packages"
echo "pkg_list_base=$pkg_list_base"
#exit 1
echo "
Capturing current list of conda packages in
@tacaswell
tacaswell / figureissue.ipynb
Last active June 28, 2016 14:50 — forked from cycomanic/figureissue.ipynb
interactive figure issues matplotlib notebook backend
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Quick example on how to read utf-8 files
@tacaswell
tacaswell / tb.txt
Created June 2, 2016 14:28
get_timevars bug
TypeError Traceback (most recent call last)
<ipython-input-12-6114c6ec2b0f> in <module>()
----> 1 gs.RE(ud_crab_plan(pu,19.02, 19.0, 19.00, 19.0), lt)
/home/xf05id1/conda_envs/collection/lib/python3.4/site-packages/bluesky/run_engine.py in __call__(self, plan, subs, raise_if_interrupted, **metadata_kw)
576 exc = self._task.exception()
577 if exc is not None:
--> 578 raise exc
579 if raise_if_interrupted and self._interrupted:
580 raise RunEngineInterrupted("RunEngine was interrupted.")