Skip to content

Instantly share code, notes, and snippets.

Avatar

Maksim Rakitin mrakitin

  • Brookhaven National Laboratory
  • Upton, NY
View GitHub Profile
@mrakitin
mrakitin / laptop_camera.py
Created Feb 6, 2018
Trigger laptop camera
View laptop_camera.py
import cv2
import matplotlib.pyplot as plt
class LaptopCamera:
def __init__(self, cam_id=0):
self.cam_id = cam_id
# There must be some "lazy" way to initialize it
self.cap = cv2.VideoCapture(cam_id)
self.cap.release()
View streaming_arrow.py
import random
import time
from collections import deque
from threading import Thread
import zmq
import numpy as np
import pandas as pd
View keybase.md

Keybase proof

I hereby claim:

  • I am mrakitin on github.
  • I am mrakitin (https://keybase.io/mrakitin) on keybase.
  • I have a public key ASCq44aRJAKRAJmSxGRHz8-wYzIs3bcOQK6hTENXKPXR8Ao

To claim this, I am signing this object:

View plugins_component_names.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View superbowl-scores.py
import datetime
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
d = pd.read_html('http://www.espn.com/nfl/superbowl/history/winners', header=1)
scores = []
for s in d[0]['RESULT']:
parts = s.split(',')
View bluesky_plan.py
import bluesky.plan_stubs as bps
import bluesky.plans as bp
from bluesky.callbacks.best_effort import BestEffortCallback
from bluesky.run_engine import RunEngine
from bluesky.utils import install_kicker
from databroker import Broker
from ophyd.sim import det, motor
RE = RunEngine()
db = Broker.named('temp')
View bluesky_plan_with_custom_callback.py
import bluesky.plan_stubs as bps
import bluesky.plans as bp
from bluesky.callbacks.best_effort import BestEffortCallback
from bluesky.run_engine import RunEngine
from bluesky.utils import install_kicker
from databroker import Broker
from ophyd.sim import det, motor
RE = RunEngine()
db = Broker.named('temp')
View alsmotor.py
"""
This was developed on 03/12/2020 during the ALS hackathon for the COSMIC beamline.
"""
from ophyd import PVPositioner, EpicsSignal, EpicsSignalRO, Component as Cpt
class ALSMotor(PVPositioner):
setpoint = Cpt(EpicsSignal, 'ao-MO:DVAL')
readback = Cpt(EpicsSignalRO, 'ai-MO:DRBV')
stop_signal = Cpt(EpicsSignal, 'bo-MO:STOP')
View convert_and_copy_refs.sh
#!/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:
View UM2020-centos_Vagrantfile
# -*-ruby-*-
Vagrant.configure("2") do |config|
# From https://app.vagrantup.com/metaswitch-its/boxes/centos7-min-xfce
config.vm.box = "metaswitch-its/centos7-min-xfce"
config.vm.hostname = "um2020"
config.vm.network "private_network", ip: "10.10.10.10"
config.vm.provider "virtualbox" do |v|
v.memory = 8192
v.cpus = 2
# Display the VirtualBox GUI when booting the machine
You can’t perform that action at this time.