Skip to content

Instantly share code, notes, and snippets.

@jacobtomlinson
jacobtomlinson / docker-compose.yml
Created March 25, 2021 16:43
Monitoring RAPIDS with Prometheus and Grafana (configs)
version: "3.9"
services:
rapids:
image: rapidsai/rapidsai:0.18-cuda11.0-runtime-ubuntu16.04-py3.8
ports:
- "8888:8888" # Jupyter
- "8786:8786" # Dask communication
- "8787:8787" # Dask dashboard
@danielballan
danielballan / README.md
Last active February 24, 2021 17:03
IOC connection time analysis

IOC connection time analysis

We will use caproto-shark to analyze CA network traffic. Note that the actual servers and clients involve may or may not be using caproto themselves; it does not matter.

  1. Install caproto and pandas if they are not already installed.

    pip install caproto[standard] pandas
    
@gwbischof
gwbischof / mongo_backup_cron.txt
Last active February 22, 2021 20:43
mongo_backup_cron
#!/bin/bash
# ------------------------------------------------------------------
# Simple Backup Script for MongoDB
# ------------------------------------------------------------------
# Definitions
MONGO_HOST='localhost'
MONGO_PORT="27017"
DUMP_PATH='/backup/mongo_backup'
DAYS_OF_BACKUPS=2
@danielballan
danielballan / example.py
Created December 17, 2020 19:41
Data processing inside a plan, involving externally-stored data (e.g. images)
from ophyd.sim import img as detector
from bluesky.plan_stubs import open_run, stage, unstage, close_run, trigger_and_read, subscribe, unsubscribe
from bluesky_live.bluesky_run import BlueskyRun, DocumentCache
def plan():
"""
Take 10 shots with a detector and do some data processing on the result.
Key points
@nightscape
nightscape / zmv-examples.md
Last active February 28, 2023 20:39 — forked from niksmac/zmv-examples.md
ZMV-Examples (require autoload zmv)

rename a section of a filename, i. e. example.1.{txt,conf,db} or 12345.1.{wav,ogg,mp3} and change the 1 to a 2 in the filename while preserving the rest of it.

  zmv -n '(*.)(<->)(.[^.]#)' '$1$(($2+1))$3' # would rename x.0001.y to x.2.y.
  zmv -n '(*.0#)(<->)(.[^.]#)' '$1$(($2+1))$3'

Rename files to lower case

  $ zmv '*' '${(L)f}'
#!/bin/bash
# To be run as:
# $ docker run -it --rm -v $PWD:/build quay.io/condaforge/linux-anvil-comp7:latest bash /build/gen-conda-packed-env-collection-2021-1.2.sh
set -e
umask 0002
sudo yum install mesa-libGL -y
#!/bin/bash
set -e
bib_src="$HOME/Brookhaven National Laboratory/NSLS-II SUF AI-ML - Beamline Optimization/LAB-20-2261_BL-opt.bib"
xml_src="$HOME/Brookhaven National Laboratory/NSLS-II SUF AI-ML - Beamline Optimization/LAB-20-2261_BL-opt.xml"
xml_dest="$HOME/Library/Containers/com.microsoft.Word/Data/Library/Application Support/Microsoft/Office/Sources.xml"
binary="/Applications/JabRef.localized/JabRef.app/Contents/MacOS/JabRef"
# Convert .bib file to .xml:
@danielballan
danielballan / README.md
Last active March 31, 2020 15:02
Container Builder for NSLS-II JupyterHub at SDCC

Initial setup of Docker worker VM

Start the Docker daemon and a local Docker registry.

sudo systemctl start docker
sudo docker run -d -p 5000:5000 --restart=always --name registry registry:2

Install repo2docker.

@danielballan
danielballan / draft.md
Last active March 4, 2020 21:15
Notes on Refactoring DataBroker to Use Intake

Notes on Refactoring DataBroker to Use Intake

This document is still a working draft.

Summary

We recently refactored DataBroker, a project maintained by the DOE Light Sources as part of the Bluesky Collaboration, to leverage intake and to join the nascent community around it. We adopted several good ideas from intake's design, and we

Replay

Replay documents from a bluesky run with realistic time spacing.

Example

This example acquires data with bluesky, saves the documents to disk, accesses the data using databroker, and finally uses replay to push the documents into a LiveTable callback.