Skip to content

Instantly share code, notes, and snippets.

View consideRatio's full-sized avatar
😍
Open Source

Erik Sundell consideRatio

😍
Open Source
  • Sundell Open Source Consulting AB
  • Sweden
  • X @e_Sundell
View GitHub Profile
@consideRatio
consideRatio / _helpers-randhex.tpl
Last active April 7, 2023 23:06
Helm helper template randHex to generate random hexadecimal (hex, base16) numbers
{{/*
Returns given number of random Hex characters.
In practice, it generates up to 100 randAlphaNum strings
that are filtered from non-hex characters and augmented
to the resulting string that is finally trimmed down.
*/}}
{{- define "jupyterhub.randHex" -}}
{{- $result := "" }}
{{- range $i := until 100 }}
@consideRatio
consideRatio / feedback.py
Created February 23, 2022 13:28
Feedback på kodexempel
start_over='true'
while start_over == 'true':
print('Mata in')
principle=int(input('Startsumma:'))
rate=float(input('Förmodad ränta per år:'))
time=int(input('Sparhorisont (antal år):'))
real_rate = rate * 0.01
a = 0
@consideRatio
consideRatio / calculating_profile_list_options.py
Created March 13, 2023 17:20
Script in development used to calculate profile_list request for memory and cpu for `n2-highmem-[4|16|64]` nodes and `r5.[|4|16]xlarge` nodes
"""
This is a basic script that prints shares of CPU/Memory for machines of
different size. The script reads a list of nodes specifications, then prints
node share choices based on how much memory is required.
The mem_guarantee specification is calculated for each node by first subtracting
4 GB of memory for each node. This is to ensure that all nodes retain ~4 GB of
memory.
"""
"""
Check for orphan single-user pods
Compares JupyterHub API list of running servers
to list of running pods in kubernetes
in order to identify discrepancies
see https://github.com/jupyterhub/kubespawner/pull/742
"""
# This is a JupyterHub Helm chart (z2jh) configuration file that:
#
# - injects a Python script to /tmp/cleanup-orphaned-pods.py via hub.extraFiles
# - defines a managed JupyterHub service to run the Python script with
# permissions ask the JupyterHub REST API about what users' servers are active
#
# It was developed to help cleanup user server pods that could end up orphaned
# by JupyterHub using KubeSpawner 5.0-6.0 or the z2jh versioned 3.0. For more
# information, visit this forum post:
# https://discourse.jupyter.org/t/how-to-cleanup-orphaned-user-pods-after-bug-in-z2jh-3-0-and-kubespawner-6-0/21677