This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # this will chain the fit and predict, i.e. fit will run only on predict success | |
| with om.runtime.chain() as crt: | |
| crt.model('regmodelx').fit('sample[y]', 'sample[x]') | |
| crt.model('regmodelx').predict([5], rName='foox') | |
| result = crt.run() | |
| # sometime later | |
| print(result.get()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -e | |
| # https://unix.stackexchange.com/a/315517 | |
| sudo systemctl stop apt-daily.service apt-daily-timer apt-daily-upgrade.timer || true | |
| sudo systemctl kill --kill-who=all apt-daily.service || true | |
| # https://github.com/rancher/rancher/issues/27353#issuecomment-706103308 | |
| sudo killall dpkg || true | |
| sudo rm -f /var/lib/dpkg/lock || true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @contextmanager | |
| def timeit(): | |
| """ straight forward statement timer for Python | |
| Usage: | |
| with timeit() as timer: | |
| ... | |
| print(timer.elpased()) # prints the timedelta, timer also has .start, .end | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| subprocess.run("getgist miraculixx progress.py".split(' ')) | |
| import omegaml as om_ | |
| from progress import progress | |
| om = om_ | |
| def match_active_queues(queue=None, nodes=None): | |
| queues = om.runtime.celeryapp.control.inspect().active_queues() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def progress(fn): | |
| """decorator to run fn until timeout in seconds, or wait forever if timeout < 0 | |
| Usage: | |
| @progress | |
| def fn(..): | |
| return stop-flag, result | |
| stopped, result = fn(.., timeout=SECONDS, stop_on_error=True|False, interval=SECONDS) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # put this in ./dependencies | |
| # add external dependencies that cannot be added as a repository | |
| # then add this directory as a file | |
| # for every external chart, script the download as shown in localpath example, add to build target dependencies | |
| # use $ make build to download all dependencies, build packages and local repo index | |
| localpath: | |
| mkdir -p staging | |
| curl https://codeload.github.com/rancher/local-path-provisioner/tar.gz/v0.0.15 -o staging/localpath.tgz | |
| cd staging && tar -xzf localpath.tgz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setup | |
| 1. Install video 4 linux (v4l) | |
| https://github.com/umlaeute/v4l2loopback | |
| 2. Install ffmpeg | |
| https://linuxize.com/post/how-to-install-ffmpeg-on-ubuntu-18-04/ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # (c) miraculixx, licensed as by the terms of WTFPL, http://www.wtfpl.net/txt/copying/ | |
| # License: DO WHATEVER YOU WANT TO with this code. | |
| # | |
| # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
| # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
| # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
| # | |
| from io import StringIO | |
| from contextlib import contextmanager |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # this is the rancher docker installation script with nvidia support | |
| # apply to NVIDIA GPU nodes only | |
| # sources | |
| # https://www.tensorflow.org/install/docker | |
| # https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#pre-installation-actions | |
| # https://github.com/NVIDIA/nvidia-docker/wiki/Frequently-Asked-Questions#how-do-i-install-the-nvidia-driver | |
| # https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu-installation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <style> | |
| #canvas { | |
| border-color: black; | |
| border-style: solid; | |
| width: 128px; | |
| height: 128px; | |
| } | |
| #resized { |