Skip to content

Instantly share code, notes, and snippets.

View lsloan's full-sized avatar

Mr. Lance E Sloan «UMich» lsloan

  • Teaching and Learning (@tl-its-umich-edu) at University of Michigan: Information and Technology Services
  • Ann Arbor, Michigan, USA
  • 03:28 (UTC -04:00)
  • X @lsloan_umich
View GitHub Profile
version: '3'
services:
jupyter:
container_name: my_jupyter
#image: jupyter/datascience-notebook
image: jupyter/minimal-notebook
ports:
- '127.0.0.1:8888:8888'
environment:
## Initial setup you should only have to do this once
# Checkout docker stacks project
git clone https://github.com/jupyter/docker-stacks
cd docker-stacks/base-notebook
# Clone the telemetry in this directory, this is currently a private repo.
git clone https://github.com/educational-technology-collective/hwf-jupyterlab-telemetry
# git needs to be added to base image
@lsloan
lsloan / docker-compose.yml
Created May 12, 2021 03:29 — forked from cboettig/docker-compose.yml
debugging NGINX configuration for Jupyter
jupyter:
image: jupyter/datascience-notebook
environment:
- PASSWORD=${PASSWORD}
nginx:
image: nginx
links:
- jupyter
@lsloan
lsloan / icalendarextract.ipynb
Last active April 7, 2021 20:46
icalendarExtract.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lsloan
lsloan / markdown-details-collapsible.md
Created November 6, 2020 15:35 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@lsloan
lsloan / reverseadmin.py
Last active October 21, 2020 20:09 — forked from wolever/reverseadmin.py
Forked from (https://gist.github.com/wolever/fdd36cbde02ca5cf085c), updated to work with Django 3.1
# -*- coding: utf-8 -*-
import functools
from django.contrib.admin import ModelAdmin
from django.contrib.admin.options import InlineModelAdmin
from django.contrib.admin.utils import flatten_fieldsets
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import OneToOneField, ForeignKey
from django.forms import ModelForm
from django.forms.models import BaseModelFormSet, modelformset_factory
@lsloan
lsloan / recursiveFormat.py
Last active October 16, 2020 18:08 — forked from sloanlance/recursiveFormat.py
`recursiveFormat()` – Recursively apply `string.format()` to all strings in a data structure.
def recursiveFormat(args, **kwargs):
"""
Recursively apply `string.format()` to all strings in a data structure.
This is intended to be used on a data structure that may contain
format strings just before it is passed to `json.dump()` or `dumps()`.
Ideally, I'd like to build this into a subclass of `json.JsonEncoder`,
but it's tricky to separate out string handling in that class. I'll
continue to think about it.
@lsloan
lsloan / ngrok_public_url.sh
Last active August 25, 2020 18:00
Get the local ngrok public URL, which includes the hostname, extracted using jq
#!/bin/sh --
# Get the local ngrok public URL, which includes the hostname, extracted using jq
# Inspiration: https://gist.github.com/rjz/af40158c529d7c407420fc0de490758b#gistcomment-2594627
curl --silent http://127.0.0.1:4040/api/tunnels | jq -r '.tunnels[0].public_url'
@lsloan
lsloan / replace_pandas.py
Created August 13, 2020 19:49 — forked from okdolly-001/replace_pandas.py
Replace values in dataframe from another dataframe ? #pandas
1. Substitute the NaN's in a dataframe with values from another dataframe
If you have two DataFrames of the same shape, then:
df[df.isnull()] = d2
2.Replace values in a dataframe with values from another dataframe by conditions