In iTerm2, in the menu bar go to Scripts > Manage > New Python Script
Select Basic. Select Long-Running Daemon
Give the script a decent name (I chose auto_dark_mode.py)
Save and open the script in your editor of choice.
| # IPs taken from: | |
| # https://openai.com/searchbot.json | |
| # https://openai.com/chatgpt-user.json | |
| # https://openai.com/gptbot.json | |
| # And presumably could change. | |
| location / | |
| { | |
| #deny OAI-SearchBot | |
| deny 20.42.10.176/28; |
| #include <vector> | |
| #include <algorithm> | |
| /** | |
| * Argsort(currently support ascending sort) | |
| * @tparam T array element type | |
| * @param array input array | |
| * @return indices w.r.t sorted array | |
| */ | |
| template<typename T> |
| export GITHUB_USER=magickatt | |
| export GITHUB_TOKEN=secret | |
| export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk | |
| git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} |
| // This is an example of how to to trap Cntrl-C in a cross-platform manner | |
| // it creates a simple REPL event loop and shows how to interrupt it. | |
| #include <csignal> | |
| #include <cstdlib> | |
| // This global is needed for communication between the signal handler | |
| // and the rest of the code. This atomic integer counts the number of times | |
| // Cntl-C has been pressed by not reset by the REPL code. | |
| volatile sig_atomic_t global_status_flag = 0; |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| def show_images(images, cols = 1, titles = None): | |
| """Display a list of images in a single figure with matplotlib. | |
| Parameters | |
| --------- | |
| images: List of np.arrays compatible with plt.imshow. | |
| (setq evil-want-C-u-scroll t) ; Ctrl-u to scroll up | |
| ;; evil | |
| (live-load-config-file "evil-conf.el") | |
| ;; evil-leader | |
| (live-load-config-file "evil-leader-conf.el") | |
| ;; evil-surround | |
| (live-load-config-file "evil-surround-conf.el") |
| <html> | |
| <head> | |
| <script src='http://code.jquery.com/jquery-1.5.1.min.js'></script> | |
| </head> | |
| <body> | |
| <h2>Naive canvas</h2> | |
| <canvas id="naive" width="400" height="50"></canvas> | |
| <h2>High-def Canvas</h2> |