From 47a3ba1605382e98d8fbbc7befb407b3717962bb Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Sat, 29 Jun 2024 23:01:37 +0200 Subject: [PATCH] init --- .gitignore | 3 + data.py | 433 +++++++++++++++++++++++++++++++++++++++++++++++ main.py | 96 +++++++++++ requirements.txt | 0 setup.sh | 10 ++ 5 files changed, 542 insertions(+) create mode 100644 .gitignore create mode 100644 data.py create mode 100644 main.py create mode 100644 requirements.txt create mode 100755 setup.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a1b515 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/venv + +__pycache__ diff --git a/data.py b/data.py new file mode 100644 index 0000000..47e09ad --- /dev/null +++ b/data.py @@ -0,0 +1,433 @@ + +# https://survey.stackoverflow.co/2023/#technology-top-paying-technologies +pay = ({ + 'ada': 71_500, + 'apex': 81_552, + 'apl': 77_500, + 'assembly': 77_010, + 'bash': 85_672, + 'c': 74_351, + 'c#': 74_963, + 'c++': 74_963, + 'clojure': 96_381, + 'cobol': 76_000, + 'crystal': 77_104, + 'css': 70_148, + 'dart': 55_862, + 'delphi': 69_608, + 'dotnet': 65_000, + 'elixir': 96_381, + 'erlang': 99_492, + 'f#': 99_311, + 'flow': 88_934, + 'fortran': 76_104, + 'gdscript': 69_608, + 'go': 92_760, + 'groovy': 86_271, + 'haskell': 85_672, + 'html': 70_148, + 'java': 72_701, + 'javascript': 74_034, + 'julia': 74_963, + 'kotlin': 78_207, + 'lisp': 96_381, + 'lua': 80_690, + 'matlab': 61_735, + 'nim': 80_000, + 'objective-c': 90_000, + 'ocaml': 91_026, + 'perl': 94_540, + 'php': 58_899, + 'powershell': 81_311, + 'prolog': 70_000, + 'python': 78_331, + 'r': 74_963, + 'raku': 79_448, + 'ruby': 98_522, + 'rust': 87_012, + 'sas': 81_000, + 'scala': 96_381, + 'solidity': 72_656, + 'sql': 74_963, + 'swift': 86_897, + 'typescript': 77_104, + 'vb': 65_698, + 'zig': 103_611, +}) + +# https://en.wikipedia.org/wiki/Timeline_of_programming_languages +release = ({ + 'a': 1952, + 'a+': 1988, + 'abap': 1983, + 'abc': 1975, + 'actionscript': 1998, + 'actor': 1988, + 'ada': 1980, + 'address programming language': 1955, + 'agda': 2007, + 'algae': 1951, + 'algol': 1958, + 'alma': 2004, + 'altair basic': 1975, + 'amiga e': 1993, + 'amos basic': 1990, + 'ampl': 1990, + 'ans forth': 1994, + 'apl': 1962, + 'apple iii microsoft basic': 1980, + 'applescript': 1993, + 'applesoft basic': 1977, + 'applesoft ii basic': 1978, + 'applesoft iii': 1980, + 'apt': 1959, + 'arc': 1947, + 'arith-matic': 1954, + 'aspectj': 2001, + 'atlas autocode': 1965, + 'awk': 1979, + 'b': 1969, + 'bacaic': 1955, + 'ballerina': 2017, + 'bash': 1989, + 'basic assembly language': 1964, + 'basic four': 1974, + 'basic': 1964, + 'bbc basic': 1981, + 'bcpl': 1967, + 'begriffsschrift': 1879, + 'bliss': 1970, + 'boehm unnamed coding system': 1951, + 'boo': 2003, + 'borland delphi': 1995, + 'borland pascal': 1992, + 'bosque': 2019, + 'bourne shell': 1977, + 'brainfuck': 1993, + 'c': 1972, + 'c#': 2000, + 'c++': 1983, + 'carbon': 2022, + 'cbasic': 1980, + 'ceylon': 2011, + 'chapel': 2009, + 'claire': 1994, + 'clarion': 1986, + 'clascal': 1983, + 'clean': 1987, + 'clipper': 1984, + 'clojure': 2007, + 'clu': 1974, + 'cobol': 1959, + 'cobol': 1960, + 'cobra': 2006, + 'coffeescript': 2009, + 'coldfusion': 1995, + 'comal': 1973, + 'combined programming language': 1963, + 'comit': 1957, + 'comit': 1961, + 'commodore basic': 1977, + 'common lisp': 1984, + 'compiler description language': 1971, + 'component pascal': 1997, + 'compool': 1952, + 'comtran': 1957, + 'coq': 1984, + 'coral': 1966, + 'corvision': 1986, + 'cowsel': 1964, + 'crystal': 2014, + 'css': 1996, + 'cuneiform': 2013, + 'curl': 1996, + 'd': 2001, + 'dafny': 2009, + 'darkbasic': 2000, + 'dart': 2011, + 'dibol': 1968, + 'draco': 1982, + 'dylan': 1992, + 'e': 1997, + 'ecmascript': 1997, + 'edinburgh imp': 1969, + 'editing generator': 1952, + 'edsac initial orders': 1949, + 'eiffel': 1986, + 'elixir': 2012, + 'elm': 2012, + 'eniac coding system': 1943, + 'eniac short code': 1946, + 'erlang': 1986, + 'euclid': 1977, + 'eulisp': 1990, + 'euphoria': 1993, + 'exapt': 1967, + 'f-script': 1997, + 'f#': 2005, + 'fact': 1959, + 'factor': 2003, + 'fantom': 2005, + 'fish': 2005, + 'flow-matic': 1955, + 'forth': 1968, + 'fortran': 1954, + 'fortress': 2006, + 'fp': 1977, + 'freebasic': 2004, + 'freiburger code': 1955, + 'gambas': 1999, + 'game maker language': 1999, + 'gdscript': 2001, + 'genie': 2008, + 'george': 1957, + 'gfa basic': 1986, + 'gleam': 2024, + 'glennie autocode': 1952, + 'gnu e': 1991, + 'go': 2009, + 'gosu': 2002, + 'gpss': 1961, + 'grass': 1974, + 'groovy': 2004, + 'gw-basic': 1983, + 'hack': 2014, + 'hal': 1978, + 'hamilton c shell': 1988, + 'harbour': 1999, + 'haskell': 1990, + 'haxe': 2005, + 'hopscotch': 2013, + 'hy': 2013, + 'hypertalk': 1987, + 'ibm basica': 1981, + 'ibm rpg': 1964, + 'icon': 1977, + 'icon': 1979, + 'idl': 1977, + 'idris': 2009, + 'iitran': 1964, + 'informix-4gl': 1986, + 'integer basic': 1976, + 'intercal': 1972, + 'interlisp': 1967, + 'intermediate programming language': 1951, + 'io': 2002, + 'ipl i': 1954, + 'ipl ii': 1958, + 'ipl v': 1958, + 'islisp': 1997, + 'iswim': 1966, + 'it': 1955, + 'j': 1990, + 'jacquard machine': 1804, + 'java': 1995, + 'javascript': 1995, + 'join java': 2000, + 'joss i': 1963, + 'joss ii': 1966, + 'jovial': 1959, + 'joy': 2001, + 'julia': 2012, + 'k': 1993, + 'klammerausdrücke': 1951, + 'kornshell': 1983, + 'kotlin': 2011, + 'krl': 1971, + 'labview': 1986, + 'laning and zierler system': 1954, + 'lasso': 1996, + 'lean': 2013, + 'lis': 1973, + 'lisp': 1956, + 'lisp': 1959, + 'little b': 2004, + 'livecode transcript': 1993, + 'livescript': 1995, + 'logo': 1968, + 'logtalk': 1998, + 'lolcode': 2007, + 'lpc': 1989, + 'lua': 1993, + 'm': 1998, + 'mad – michigan algorithm decoder': 1959, + 'mad': 1965, + 'magik': 1989, + 'mapper': 1968, + 'mark i autocode': 1954, + 'mark-iv': 1964, + 'math-matic': 1954, + 'mathematica': 1988, + 'matlab': 1978, + 'matrix math': 1954, + 'mercury': 1995, + 'mesa': 1976, + 'microsoft power fx': 2021, + 'mimic': 1964, + 'miranda': 1986, + 'ml': 1973, + 'modula': 1975, + 'modula': 1979, + 'modula': 1989, + 'mojo': 2023, + 'mumps': 1967, + 'nemerle': 2003, + 'netrexx': 1996, + 'newtonscript': 1993, + 'nim': 2008, + 'nix': 2003, + 'oberon': 1987, + 'oberon': 1991, + 'oberon': 2007, + 'object oberon': 1990, + 'object pascal': 1986, + 'object rexx': 1988, + 'objective-c': 1983, + 'ocaml': 1996, + 'occam': 1983, + 'occam': 1987, + 'octave': 1988, + 'opa': 2011, + 'operator programming': 1952, + 'opl': 1984, + 'optimj': 2006, + 'oxygene': 2005, + 'oz': 1991, + 'pact i': 1955, + 'paradox': 1985, + 'parasail': 2009, + 'pascal': 1970, + 'perl data language': 1996, + 'perl': 1987, + 'php': 1995, + 'pico': 1997, + 'pike': 1994, + 'pilot': 1968, + 'pl': 1964, + 'pl': 1965, + 'pl': 1968, + 'pl': 1968, + 'pl': 1969, + 'pl': 1972, + 'plankalkül': 1943, + 'plankalkül': 1948, + 'polymorphic programming language': 1969, + 'pop': 1968, + 'pop': 1970, + 'postscript': 1982, + 'powerbasic': 1989, + 'print': 1955, + 'processing': 2001, + 'prolog': 1972, + 'promal': 1986, + 'prose modeling language time-sharing version': 1975, + 'prose modeling language': 1974, + 'pure': 2008, + 'purebasic': 1998, + 'purescript': 2013, + 'pwct': 2005, + 'python': 1991, + 'q': 1991, + 'q#': 2017, + 'qb': 2007, + 'quickbasic': 1985, + 'r': 1993, + 'racket': 1995, + 'raku': 2015, + 'rapid': 1994, + 'rapt': 1978, + 'ratfor': 1976, + 'read': 1953, + 'reason': 2016, + 'rebol': 1997, + 'red': 2011, + 'redcode': 1984, + 'refal': 1968, + 'rexx': 1979, + 'ring': 2016, + 'rpg ii': 1965, + 'rpg iii': 1978, + 'rpl': 1984, + 'ruby': 1995, + 'rust': 2010, + 's-lang': 1992, + 's': 1976, + 'sail': 1970, + 'sas': 1976, + 'sasl': 1972, + 'sather': 1990, + 'scala': 2003, + 'scheme': 1975, + 'scratch': 2002, + 'sed': 1974, + 'seed': 2005, + 'self': 1987, + 'self': 1993, + 'sequentielle formelübersetzung': 1955, + 'setl': 1969, + 'shakespeare programming language': 2001, + 'short code': 1949, + 'short code': 1950, + 'short code': 1952, + 'simula': 1962, + 'simula': 1967, + 'skill': 1990, + 'small': 1978, + 'smalltalk': 1972, + 'smalltalk': 1976, + 'smalltalk': 1980, + 'snobol': 1962, + 'snobol': 1963, + 'snobol': 1967, + 'solidity': 2014, + 'sort merge generator': 1951, + 'spark': 1988, + 'speakeasy-iv': 1982, + 'speakeasy': 1964, + 'speakeasy': 1973, + 'speedcoding': 1953, + 'squeak': 1997, + 'squirrel': 2003, + 'standard c++': 1998, + 'standard ml': 1984, + 'standard mumps': 1977, + 'stanislaus': 1951, + 'stos basic': 1988, + 'sql': 1972, + 'subtext': 2004, + 'superplan': 1951, + 'swift': 2007, + 'swift': 2014, + 'tcl': 1988, + 'tea': 1997, + 'telcomp': 1965, + 'ti basic': 1979, + 'ti extended basic': 1981, + 'trac': 1959, + 'trac': 1964, + 'true basic': 1983, + 'ttm': 1968, + 'turbo basic': 1987, + 'turbo pascal oop': 1989, + 'turbo pascal': 1983, + 'turing': 1982, + 'tutor': 1969, + 'typescript': 2012, + 'unicode': 1957, + 'unrealscript': 1998, + 'v': 2019, + 'vala': 2006, + 'vbscript': 1996, + 'visicalc': 1978, + 'vissim': 1989, + 'visual basic .net': 2001, + 'vb': 1991, + 'vulcan dbase-ii': 1979, + 'whiley': 2009, + 'windows powershell': 2006, + 'xojo': 1998, + 'xslt': 1998, + 'z shell': 1990, + 'zig': 2015, + 'zpl': 1993, +}) \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..04ce909 --- /dev/null +++ b/main.py @@ -0,0 +1,96 @@ +#!/bin/env -S python + +from matplotlib import pyplot +from matplotlib.axes import Axes +from adjustText import adjust_text + + +from data import (pay, release) + + +def center(data: list[tuple[str, list[float]]], padding: float = 0): + for axis_index in range(len(data[0][1])): + min_ = min(data, key=lambda e: e[1][axis_index])[1][axis_index] + max_ = max(data, key=lambda e: e[1][axis_index])[1][axis_index] + delta = max_ - min_ + desired_bias = (1 - padding) + desired_delta = 2 * desired_bias + for (_, values) in data: + original = values[axis_index] + value = (original - min_) / delta + value = (value * desired_delta) - desired_bias + values[axis_index] = value + + +to_rank = { + 'c#', + 'assembly', + 'bash', + 'basic', + 'brainfuck', + 'c', + 'c++', + 'cobol', + 'css', + 'dart', + 'elixir', + 'excel', + 'fim++', + 'fortran', + 'go', + 'haskell', + 'java', + 'javascript', + 'jsfuck', + 'julia', + 'kotlin', + 'lisp', + 'lolcode', + 'lua', + 'matlab', + 'objective-c', + 'ocaml', + 'perl', + 'php', + 'punch cards', + 'python', + 'r', + 'redstone', + 'ruby', + 'rust', + 'sass', + 'scala', + 'scratch', + 'sql', + 'swift', + 'typescript', + 'vb', + 'wasm', + 'whitespace', + 'zsh', +} + + +ranked = list[tuple[str, list[float]]]( + (label, [pay[label], release[label]]) + for label in to_rank + if label in pay and label in release +) +center(ranked, 0.1) + + +print("\nunused", [l for l in pay.keys() if not l in map(lambda e: e[0], ranked)]) +print("\nunused", [l for l in release.keys() if not l in map(lambda e: e[0], ranked)]) +print("\nnot found", [l for l in to_rank if not l in map(lambda e: e[0], ranked)]) +print("\nranked", ranked) + + +(figure, axes) = pyplot.subplots() +assert type(axes) is Axes +axes.plot([-1, 1], [0, 0]) +axes.plot([0, 0], [-1, 1]) +texts = [axes.text(p, r, l) for (l, [r, p]) in ranked] +adjust_text(texts, only_move={'points':'y', 'texts':'y'}) + + +pyplot.show() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..9f3acbf --- /dev/null +++ b/setup.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e +cd "$(dirname "$(realpath "$0")")" + + +python -m venv venv +. ./venv/bin/activate + + +pip install --requirement requirements.txt