monitoring – Netdata, prometheus and grafana – why recommended in this constellation?

Currently I do setup monitoring-service for our Server.
I’ve found some articles, which recommend to use: Netdata, prometheus and grafana

So I wonder what are the benefits to use all three of them.
Can anybody explain it to me, why prometheus and grafana is recommended, if it’s seems that netdata do the same stuff as those both?

Even at the netdata-documentations, there are an article about the setup for this:

What are the benefits of this constellation?

Feedback on Pitch Constellation/ Chromatic Circle in Python Project

Hello I’m doing a mini project that is modeled after pitch constellation.
Basically, pitch constellation is modeled after a clock where each note is assigned a number. When the wheel goes clockwise it goes up the scale, and when it goes counterclockwise it goes down. I thought this might be a great idea for a midi project. (My project only goes up the scale.)

Here’s how it works:

  1. It prompts for an input of a music note and then shifts the elements so that the list will start with the root key. Then it will return the notes starting with the root note or the note selected.

  2. Then it prompts to enter what mode to return the music note values. The way this done is by assigning the elements in the returned notes to the value selected in the dict variable scale. Which will then select the index number of the items and create a new list.

  3. Lastly, it returns the scale with the key and mode.

That’s all it does so far. Eventually, I’d like to combine it with a midi module I found in pythons open library and then have it send midi out. I want to get honest feedback on what areas can be improved in my program before I go any further.

import random
notes = ('C', 'C#', 'D', 'D#',
             'E', 'F', 'F#', 'G', 'G#',
             'A', 'A#','B')

scale = {'major':(0, 2, 4, 5, 7, 9, 11),
    'minor':(0, 2, 3, 5, 7, 8, 10),
    'phrygian':(0, 1, 3, 5, 7, 8, 10),
    'lydian':(0, 2, 4, 6, 7, 9, 11),
    'mixolydian':(0, 2, 4, 5, 7, 9, 10),
    'aeolian':(0, 2, 3, 5, 7, 8, 10),
    'locrian':(0, 1, 3, 5, 6, 8, 10),
    'chromatic':(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11),
    'wholetone':(0, 2, 4, 6, 8, 10),
    'diminished7thchord': (0, 3, 6, 9),
    'augmentedchord':(0, 4, 8),
    'tritone':(0, 6)}

rootkey = input("Enter the root Note: ").upper()

class CircleFifths:
    """docstring for CircleFifths."""
    def __init__(self, key):
        self.rootkey = rootkey

    def shift(self, rootkey, index=0, s=0,):
        #shifts the leading item (rootkey) entered by the user down the list
        #removes the last term and puts it as the first term
        while index < 12 and s <12:
            s += 1
            index += 1
            new_notes = notes(-s:) + notes(:-s)
            if rootkey == new_notes(0):
                return new_notes

def main():
    a = CircleFifths(rootkey)
    key = a.shift(rootkey)

    keymode = ()

    print('Select a scale and enter it below')
    for k in scale:

    mode = input("Enter the mode: ").lower()
        x = scale.get(mode)
        keymode = (key(i) for i in x)
        if mode not in scale:
            print("Scale not in list. Please start the program again.")



computational geometry – Find angle between two images of a constellation

I am given two images of a constellation differing by an angle and I need to find that angle $theta$. This is a problem of this past contest

Here is my idea:

  • If first image is $(p_0, p_1, … p_n)$ then the other image would be $(p_{pi(1)}cdot R_theta,p_{pi(2)}cdot R_theta,…)$ where $R_{theta}=begin{pmatrix}cos theta&sintheta\-sintheta&cos thetaend{pmatrix}$ and $pi:{mathbb Z_n }mapsto{mathbb Z_n}$ is a permutation.

  • We can consider the cyclic path from $p_0$ to $p_1$ and so on and back to $p_0$. We can find angle of rotation we make at a point $p_i$, i.e. if the angle between $p_i-p_{i-1}$ and $p_{i+1}-p_i$. Let us denote this by $Deltatheta_i$ in first image and $Deltatheta’_i$ in second image.

  • This will remain same for both the images and we can find find the index $j=pi(1)$ such that $Deltatheta_1=Deltatheta’_{j}$.

  • Now the required angle would be the angle between $p_2-p_1$ and $p_{j+1}-p_j$.

Now I wrote this code but I am getting ‘Wrong Answer’, so what am I doing wrong?

import           Control.Monad
import           Control.Arrow
import           Data.List
import           System.IO

type Point = (Double, Double)

main :: IO ()
main = do
    h         <- openFile "" ReadMode
    n         <- read <$> hGetLine h
    (ps, ps') <- splitAt n
        <$> replicateM (2 * n) (((a, b) -> (a, b)) . map read . words <$> hGetLine h)
    let qs    = getDeltas ps
        qs'   = getDeltas ps'
        rs    = getDeltas' qs
        rs'   = getDeltas' qs'
        idx   = getMatchingIndex rs rs'
        theta = head qs - (qs' !! idx)
        delta = head rs - (rs' !! idx)
    when (abs delta > 1e-5) $ error "No soution"
    h' <- openFile "d.out" WriteMode
    hPrint h' $ if theta < 0 then theta + 2 * pi else theta
    hClose h'

getDeltas' :: (Double) -> (Double)
getDeltas' xs = map (theta -> if theta < 0 then theta + 2 * pi else theta)
    $ zipWith (-) (tail $ cycle xs) xs

getAngle :: Point -> Point -> Double
getAngle (x, y) (x', y') =
    let theta = atan2 y' x' - atan2 y x -- (-pi, pi) - (-pi, pi) = (-2pi, 2pi)
    in  if theta < 0 then theta + 2 * pi else theta -- (0, 2pi)

getDeltas :: (Point) -> (Double) -- (0,pi)
getDeltas xs =
    zipWith ((x, y) (x', y') -> getAngle (1, 0) (x' - x, y' - y)) xs (tail $ cycle xs)

getMatchingIndex :: (Double) -> (Double) -> Int
getMatchingIndex xs ys = go 0 xs (ys ++ tail ys)
    go k xs ys = if and (zipWith (a b -> abs a - abs b <= 1e-5) xs ys)
        then k
        else go (k + 1) xs (tail ys)