This file contains 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
from time import perf_counter | |
class catchtime: | |
def __enter__(self): | |
self._time_start = perf_counter() | |
return self | |
def __exit__(self, type, value, traceback): | |
self.elapsed = perf_counter() - self._time_start |
This file contains 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
ls -tr1 | while read line; do echo file \'$line\'; done | ffmpeg -protocol_whitelist file,pipe -f concat -i - -c copy ../output.mp4 |
This file contains 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/bash | |
resp=$(curl -sS http://127.0.0.1:4040/api/tunnels || echo 0) | |
if [[ $resp == "0" ]]; then | |
echo "Restarting service" >&2 | |
pkill ngrok | |
screen -dmS ngrok /home/human/ngrok start --all | |
sleep 90 | |
resp=$(curl -sS http://127.0.0.1:4040/api/tunnels) | |
fi |
This file contains 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 numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
from sklearn.metrics import confusion_matrix | |
def print_confusion_matrix(y_true, y_pred, class_names, normalize=True, figsize = (10,7), fontsize=14): | |
"""Prints a confusion matrix, as returned by sklearn.metrics.confusion_matrix, as a heatmap. | |
This file contains 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
FROM apache/zeppelin:0.8.1 | |
RUN wget https://apache-mirror.rbc.ru/pub/apache/spark/spark-2.4.5/spark-2.4.5-bin-hadoop2.7.tgz \ | |
&& tar -xzf spark-2.4.5-bin-hadoop2.7.tgz \ | |
&& mv spark-2.4.5-bin-hadoop2.7 /opt/spark | |
ENV SPARK_HOME=/opt/spark | |
EXPOSE 8080 |
This file contains 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
''' | |
Levit's algorithm for finding the shortest path from one `start` node to all another. | |
Written according to this article: https://goo.gl/GoeKS5 | |
Doesn't work with negative cycles. | |
See example at the end. | |
''' | |
from collections import defaultdict, OrderedDict | |
from itertools import chain | |
from math import inf |