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 numpy as np | |
| validators_online = 102 | |
| consensus_size = 28 | |
| replacement_factor = 4 | |
| validators = np.arange(validators_online) | |
| replacement_N = len(validators) // replacement_factor | |
| N = 10000 |
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
| adapters = np.sort(adapters) | |
| start = 0 | |
| end = np.max(adapters) + 3 | |
| cache = {} | |
| def next_in_line(last_link): | |
| if last_link in cache: | |
| return cache[last_link] |
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/bash | |
| # Modified from: https://faq.i3wm.org/question/2332/flexible-monitor-setup/ | |
| SWITCH_WS="${HOME}/scripts/i3-switch-ws" | |
| # Switch screens on, in case they were asleep | |
| xset dpms force on | |
| # Find laptop display (DEFAULT) | |
| DEFAULT=`xrandr | grep -e eDP.*connected | cut -f 1 -d ' '` |
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
| (use-package zenburn-theme | |
| :config | |
| (setq org-fontify-whole-heading-line t | |
| org-fontify-quote-and-verse-blocks t) | |
| (load-theme 'zenburn t) | |
| (zenburn-with-color-variables | |
| (custom-theme-set-faces | |
| 'zenburn | |
| `(org-level-1 ((t (:inherit ,z-variable-pitch | |
| :foreground ,zenburn-orange |
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/bash | |
| curl "https://api.github.com/repos/numpy/numpy/pulls?page=1&per_page=100" > prs0.json | |
| curl "https://api.github.com/repos/numpy/numpy/pulls?page=2&per_page=100" > prs1.json | |
| curl "https://api.github.com/repos/numpy/numpy/pulls?page=3&per_page=100" > prs2.json |
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 python | |
| import subprocess | |
| import sys | |
| from skimage import io, filters | |
| import numpy as np | |
| filename = sys.argv[1] | |
| base, ext = filename.rsplit('.', 1) | |
| outfile = f'{base} cropped.{ext}' |
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 numpy as np | |
| xs = np.linspace(2, 5, 10000) # 10000 samples of x between 2 and 5 | |
| ys = np.linspace(1, 2, 10000) # 10000 samples of y between 1 and 2 | |
| ix = np.random.randint(0, 10000, size=(10000, 2)) # random index, 2 parameters | |
| def my_model(x, y): | |
| ... # do some magic | |
| return 42 # spit out your evaluation of the model for a given x, y |
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
| $ PYTHONPATH=. pytest --doctest-modules networkx/generators/spectral_graph_forge.py | |
| ================================================================================ test session starts ================================================================================ | |
| platform linux -- Python 3.7.4+, pytest-4.3.1, py-1.8.0, pluggy-0.12.0 | |
| Using --randomly-seed=1570776077 | |
| rootdir: /home/stefan/src/networkx, inifile: | |
| plugins: randomly-2.1.1 | |
| collected 1 item | |
| networkx/generators/spectral_graph_forge.py s [100%] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| function workon { | |
| ENVS=${HOME}/envs | |
| TARGET=$ENVS/${1} | |
| if [[ -z ${1} || ! -d $TARGET ]]; then | |
| echo "Invalid environment. Choose from:" | |
| ls $ENVS | |
| else | |
| unset PYTHONPATH | |
| source $TARGET/bin/activate | |
| fi |