Skip to content

Instantly share code, notes, and snippets.


Dan Lester danlester

View GitHub Profile
danlester / GACentric_Google_RegHandler.apex
Last active Oct 11, 2016
Google Apps Login for Salesforce
View GACentric_Google_RegHandler.apex
global class GACentric_Google_RegHandler implements Auth.RegistrationHandler{
global User createUser(Id portalId, Auth.UserData data){
List<User> users = [SELECT Id, username, email FROM User WHERE email =];
if (users.size() == 0) {
return null;
danlester /
Created Jun 15, 2018
Tensorflow Datasets API for processing CSV string column into int tensor
CSV_COLUMNS = ['p{}'.format(i) for i in range(30)] + ['Image']
CSV_COLUMN_DEFAULTS = [[0.0]]*30 + [['']]
def parse_csv(rows_string_tensor):
columns = tf.decode_csv(rows_string_tensor, record_defaults=CSV_COLUMN_DEFAULTS)
raw_features = dict(zip(CSV_COLUMNS, columns))
image_str_array_sparse = tf.string_split([raw_features['Image']])
image_str_array = tf.sparse_to_dense(image_str_array_sparse.indices, image_str_array_sparse.dense_shape, image_str_array_sparse.values, '')
image_str_array = image_str_array[0]
danlester /
Last active May 10, 2020
Config to add DockerSpawner to TLJH
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
c.DockerSpawner.image = 'ideonate/jh-voila-oauth-singleuser:latest'
from jupyter_client.localinterfaces import public_ips
c.JupyterHub.hub_ip = public_ips()[0]
c.DockerSpawner.name_template = "{prefix}-{username}-{servername}"
import streamlit as st
from datetime import datetime
start_time =
count = 0
if st.button('Increment'):
count += 1
import streamlit as st
def get_start_time():
from datetime import datetime
start_time = get_start_time()
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
from datetime import datetime
app = dash.Dash(__name__)
start_time =
app.layout = html.Div(children=[
import requests
api_url = ''
token = '<token from token menu of an admin user>'
# List all groups
r = requests.get(api_url + '/groups',
View Voila Username API.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
danlester /
Created Dec 6, 2021
Generate a lot of files for testing
import os
from pathlib import Path
jupyter_user = os.environ['JUPYTERHUB_USER']
def make_files(depth, breadth, start_folder, key, max_depth=3):
print(f"Make Files at depth {depth}")
for i in range(0,breadth):
with Path(start_folder, f"testfile_{key}_{depth}_{i}.txt").open("wt") as f:
f.write("Here is the file.")
if depth < max_depth:
danlester /
Created Jan 13, 2022
Traefik CRD Terraform problem
terraform {
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.7.1"
required_version = ">= 1.0"