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
| // Install conda | |
| mkdir -p ~/miniconda3 | |
| curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/miniconda.sh | |
| bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 | |
| rm -rf ~/miniconda3/miniconda.sh | |
| ~/miniconda3/bin/conda init bash | |
| ~/miniconda3/bin/conda init zsh | |
| // Make virtual env | |
| conda create -n jupyter python ipython jupyterlab nodejs numpy matplotlib scipy ipywidgets |
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
| # get the location of the script, NOT the location we are running from | |
| # Consider if the code is run by python or exe | |
| # determine if application is a script file or frozen exe | |
| if getattr(sys, 'frozen', False): | |
| dir_path = os.path.dirname(sys.executable) | |
| elif __file__: | |
| dir_path = os.path.dirname(os.path.realpath(__file__)) |
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
| template <typename T> | |
| func() { | |
| if constexpr(std::is_same<T, TheTypeIWant>::value) { | |
| } | |
| else { | |
| } | |
| } | |
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
| find -wholename "*/.git/config" -type f -exec sed -i 's/<insertoldstring>/<insertnewstring/g' {} + | |
| git submodule sync |
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
| // https://github.com/Rezonality/mutils/blob/6adc3fa9d160f455092637032cb6fcd6162d0b93/include/mutils/math/math_utils.h#L124 | |
| template <typename T> | |
| inline T Bezier(float t, T p0, T p1, T p2, T p3) { | |
| return std::pow(1 - t, 3) * p0 + 3 * std::pow(1 - t, 2) * t * p1 + 3 * (1 - t) * (t * t) * p2 + std::pow(t, 3) * p3; | |
| } | |
| template <typename T> | |
| inline T BezierPt(float t, T p0, T p1, T p2, T p3) | |
| { |
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
| std::atomic<bool> is_from_start_solved(false); | |
| std::atomic<bool> is_from_goal_solved(false); | |
| // Example lambda to check if either is high | |
| auto is_path_solved = [&]() -> bool { return is_from_goal_solved.load() || is_from_start_solved.load(); }; | |
| auto from_start = [&]() -> void { is_from_start_solved = true; }; | |
| auto from_goal = [&]() -> void { is_from_goal_solved = false; }; | |
| std::thread t_from_start(from_start); |
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
| template <class T> | |
| class(std::vector<thing> things) { | |
| static_assert(std::is_same_v<T, TheTypeIWant>, "This constructor requires TheTypeIWant!"); | |
| } |
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
| # Individual File download | |
| if(NOT DEFINED DOWNLOADED OR NOT ${DOWNLOADED}) | |
| file(DOWNLOAD | |
| "ftp://10.0.IP.IP/example.txt" | |
| "${CMAKE_CURRENT_SOURCE_DIR}/data/" | |
| SHOW_PROGRESS | |
| STATUS status | |
| LOG log) | |
| endif() |
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 matplotlib.pyplot as plt | |
| from matplotlib import animation | |
| from matplotlib import cm | |
| fig = plt.figure() | |
| ax = fig.add_subplot(111) | |
| scat = ax.scatter([], []) | |
| def animate(i): |
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 xml.etree.ElementTree as ET | |
| import json | |
| def nested_json_set(dic, keys, value): | |
| for key in keys[:-1]: | |
| dic = dic.setdefault(key, {}) | |
| dic[keys[-1]] = value | |
| def ReplaceStringInFile(filename, child_tree, dest_ip): | |
| # try: |
NewerOlder