NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
"""Demo of how to pop up plots asynchronously using separate processes.""" | |
from multiprocessing import Process | |
import time | |
import sys | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def demo(): | |
i = 0 | |
processes = [] |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
#!/bin/bash | |
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462 | |
find . -type f -iname "*.png" -exec optipng -nb -nc {} \; | |
find . -type f -iname "*.png" -exec advpng -z4 {} \; | |
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \; | |
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \; |
import re | |
import sys | |
from os.path import splitext, basename | |
class UmlClassFigGenerator(object): | |
def __init__(self, file_list): | |
self.file_list = file_list | |
# notice: parent class was like that: "parenet_class.ClassName2" | |
self.re_class_def = re.compile(r"^class\s+([\w\d]+)\(([\w\d\._]+)\):") |
# This has been edited to work with python3. Some of the tested combinations will not work in python2. | |
import pandas as pd | |
df = pd.DataFrame({'text': [str(i % 1000) for i in range(1000000)], | |
'numbers': range(1000000)}) | |
import pickle | |
# Python 3 has no cPickle | |
#import cPickle | |
import json | |
from functools import partial |
version: '3' | |
services: | |
# FRONT | |
chronograf: | |
# Full tag list: https://hub.docker.com/r/library/chronograf/tags/ | |
image: chronograf | |
deploy: | |
replicas: 1 | |
placement: | |
constraints: |