Skip to content

Instantly share code, notes, and snippets.

Using an authenticated service in a custom template

This example embeds an authenticated request to a service into the template for /hub/home. The user may not be logged in to the service when the page is requested, so we must process the oauth login to the service in that event.

To avoid the user having to experience any of the login process, this requires:

  1. attempting to fetch the endpoint
@abraithwaite
abraithwaite / chill-zoom.sh
Last active May 8, 2024 08:43
Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/bash -xe
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice"
[Slice]
AllowedCPUs=0-4
MemoryHigh=6G
EOF
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dominikl
dominikl / segment.py
Created November 6, 2020 11:05
Segement an OMERO image and add the result as masks
import matplotlib.pyplot as plt
import numpy as np
import omero
from omero.gateway import BlitzGateway, ColorHolder
from omero.model import MaskI, RoiI
from omero.rtypes import rdouble, rint, rstring
from skimage.filters import threshold_otsu
from skimage.measure import label, regionprops
OME_HOST = "merge-ci"
@jtpio
jtpio / README.md
Last active May 26, 2021 14:29
JupyterLab 3.0.16 on Binder

JupyterLab 3.0 on Binder

Try it on Binder!

Binder

This conda environment demonstrates how to install JupyterLab extensions with conda or mamba, without any end user build or requiring Node.js.

It also installs the xeus-python kernel to enable the visual debugger sidebar by default.

@astrolox
astrolox / LICENSE
Last active April 5, 2024 03:08
Implementing Socket IO event handling via Blueprint in Flask-SocketIO - without using a single global socketio object.
Copyright 2020 Brian Wojtczak
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
@danizen
danizen / multiauthenticator.py
Created March 15, 2018 23:06
MultiAuthenticator for jupyterhub
from urllib.parse import urlsplit
from tornado import gen
from tornado.escape import url_escape
from tornado.httputil import url_concat
from traitlets import (
Unicode, Integer, Dict, TraitError, List, Bool, Any,
Type, Set, Instance, Bytes, Float,
observe, default,
# Copy the config locally so we don't lose it
cp dist/etc/grid/config.xml config.xml
# Delete all previous symlinks, so that 'clean' doesn't delete src code
rm dist/lib/python/omeroweb
rm dist/lib/python/omero/gateway
rm components/tools/target/lib/python/omeroweb
rm components/tools/target/lib/python/omero/gateway
rm components/tools/OmeroPy/target/omero/testlib/
rm components/tools/OmeroPy/target/omero/gateway
@agilepoodle
agilepoodle / mount-encrypted-partition-fedora-live-usb.sh
Created June 21, 2017 19:15
When you need to access LUKS encrypted partition with a Fedora Live CD or USB
# make sure crypt module in use
sudo modprobe dm-crypt
# Find out which drive it was with the following command:
sudo fdisk -l
# You must mount /dev/sda3 myvolume
# use cryptsetup, device is accessible under /dev/mapper/myvolume
sudo cryptsetup luksOpen /dev/sde3 myvolume
@dpwrussell
dpwrussell / workshop.md
Last active August 8, 2017 05:30
OMERO User Meeting 2017 AWS Workshop

OMERO User Meeting 2017 AWS Workshop

https://tinyurl.com/ydz73puv

What is Docker?

  • ...an open source project to pack, ship and run any application as a lightweight container.

  • An abstraction layer to "containerize" any application and allow it to run on any infrastructure
  • Used to containerize OMERO, OMERO.web and and the additional components of OMERO.cloudarchive