Skip to content

Instantly share code, notes, and snippets.

View dask.py
import os
import boto3
import yaml
jupyter_image = os.environ['JUPYTER_IMAGE']
session = boto3.Session()
credentials = session.get_credentials()
aws_creds = {'key': credentials.access_key, 'secret': credentials.secret_key}
dask_worker_spec = f'''kind: Pod
View generic.py
from oauthenticator.generic import GenericOAuthenticator
class CustomAuthenticator(GenericOAuthenticator):
async def authenticate(self, handler, data=None):
resp = await super().authenticate(handler, data)
# resp is a dict mentioned here: https://github.com/jupyterhub/oauthenticator/blob/master/oauthenticator/generic.py#L163
# modify it as you wish, set username key
modified_resp = resp.copy()
modified_resp['username'] = resp['auth_state']['oauth_resp']['attrib']['email']
return modified_resp
View values.yaml
jupyterhub:
prePuller:
continuous:
enabled: false
scheduling:
userScheduler:
enabled: false
hub:
networkPolicy:
enabled: true
@yuvipanda
yuvipanda / start-vm.py
Created Sep 24, 2019
Start a VM with Pangeo image & let you access it
View start-vm.py
#!/usr/bin/env python
import re
import subprocess
import time
import argparse
import json
IMAGE = 'pangeo/base-notebook:2019.09.21'
ZONE = 'us-central1-b'
View sample_spark.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Dockerfile
FROM yuvipanda/pangeo-base-notebook-onbuild:2019.04.15-4
View gist:1b58c4ed47148c5e9c53ea492161fec1
Nov 22 11:16:25 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Starting Google Accounts daemon.
Nov 22 11:16:25 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Creating a new user account for yuvipanda.
Nov 22 11:16:25 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Created user account yuvipanda.
Nov 22 11:16:25 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Creating a new user account for choldgraf.
Nov 22 11:16:25 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Created user account choldgraf.
Nov 22 11:16:25 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Creating a new user account for minrk.
Nov 22 11:16:25 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Created user account minrk.
Nov 22 11:16:25 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Creating a new user account for gke-df315ed616f010764e03.
Nov 22 11:16:26 gke-prod-a-core-e77a049e-591f google-accounts[475]: INFO Created user account gke-df315ed616f010764e03.
Nov 22 11:16
@yuvipanda
yuvipanda / ldapsearchauth.py
Created Jan 7, 2019
A JupyterHub authenticator that outsources to ldapsearch
View ldapsearchauth.py
"""
An authenticator that outsorces auth to ldapsearch!
Because LDAP is hard and old and terrible and you should not use it.
"""
import os
from jupyterhub.auth import Authenticator
import pexpect.exceptions
import pexpect.popen_spawn
from traitlets import Unicode
@yuvipanda
yuvipanda / hello.c
Last active Nov 14, 2018
helloworld.c
View hello.c
#include <stdio.h>
int main() {
printf("Hello world!");
return 0;
}
@yuvipanda
yuvipanda / Today's Logs
Created Nov 7, 2018
debugging logs for hub
View Today's Logs
This file has been truncated, but you can view the full file.
Loading /etc/jupyterhub/config/values.yaml
Loading /etc/jupyterhub/secret/values.yaml
[I 2018-11-07 03:12:27.089 JupyterHub app:1673] Using Authenticator: oauthenticator.google.GoogleOAuthenticator-0.8.0
[I 2018-11-07 03:12:27.089 JupyterHub app:1673] Using Spawner: builtins.CustomKubeSpawner
[I 2018-11-07 03:12:27.104 JupyterHub app:1016] Loading cookie_secret from /srv/jupyterhub/jupyterhub_cookie_secret
[W 2018-11-07 03:12:27.452 JupyterHub app:1131] JupyterHub.hub_connect_port is deprecated as of 0.9. Use JupyterHub.hub_connect_url to fully specify the URL for connecting to the Hub.
[I 2018-11-07 03:12:27.616 JupyterHub app:1201] Not using whitelist. Any authenticated user will be allowed.
[I 2018-11-07 03:12:29.980 JupyterHub reflector:199] watching for pods with label selector='component=singleuser-server' in namespace prod
[I 2018-11-07 03:12:32.953 JupyterHub reflector:199] watching for events with field selector='involvedObject.kind=Pod' in namespace prod