This file contains 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
from wgpu.utils.compute import compute_with_buffers | |
from wgpu.utils import get_default_device | |
import numpy as np | |
from time import time | |
# A "shader"" is a program that will run on the GPU: | |
SHADER = """ | |
@group(0) @binding(0) | |
var<storage,read> input1: array<i32>; |
This file contains 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
@numba.jit(nopython=True, parallel=True, fastmath=True) | |
def spatial_regularisation_numbaoptimized(x: np.ndarray, dy: int = 1, dx: int = 1) -> float: | |
ny, nx = x.shape | |
total_cost = 0.0 | |
for i in numba.prange(ny): | |
i = numba.int64(i) | |
min_y = max(i - dy, 0) | |
max_y = min(i + dy + 1, ny) | |
for j in numba.prange(nx): |
This file contains 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 | |
set -euo pipefail | |
flake8 src/ | |
python -m coverage run --branch -m twisted.trial "$@" | |
coverage combine | |
coverage xml | |
diff-cover coverage.xml --compare-branch origin/master --html-report ~/temp/tahoe-coverage.html | |
firefox ~/temp/tahoe-coverage.html |
This file contains 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
## dmesg -w -T | grep -i igc | |
``` | |
[Tue Nov 8 12:28:33 2022] igc 0000:02:00.0: PTM enabled, 4ns granularity | |
[Tue Nov 8 12:28:33 2022] igc 0000:02:00.0 (unnamed net_device) (uninitialized): PHC added | |
[Tue Nov 8 12:28:33 2022] igc 0000:02:00.0: 4.000 Gb/s available PCIe bandwidth (5.0 GT/s PCIe x1 link) | |
[Tue Nov 8 12:28:33 2022] igc 0000:02:00.0 eth0: MAC: d8:5e:d3:af:21:82 | |
[Tue Nov 8 12:28:33 2022] igc 0000:02:00.0 enp2s0: renamed from eth0 | |
[Tue Nov 8 12:28:41 2022] igc 0000:02:00.0 enp2s0: NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX | |
[Tue Nov 8 13:03:38 2022] igc 0000:02:00.0 enp2s0: PCIe link lost, device now detached |
This file contains 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 threading | |
import time | |
from _thread import interrupt_main | |
import signal | |
import os | |
import ctypes | |
def interrupter(): | |
time.sleep(1) # make sure input() is waiting | |
print("Interrupting!") |
This file contains 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
$ conda update -n base -c defaults conda | |
Solving environment: done | |
==> WARNING: A newer version of conda exists. <== | |
current version: 4.5.11 | |
latest version: 4.6.3 | |
Please update conda by running |
This file contains 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
In [4]: df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, index=["x", "y", "z"]) | |
In [5]: df | |
Out[5]: | |
a b | |
x 1 4 | |
y 2 5 | |
z 3 6 | |
In [6]: df["a"] |
This file contains 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
[ /#0 3fba6baf-8125-4f7c-8c1b-8f687d8a22d3 17:05:44.321218Z | |
action_type: "check_links" | |
action_status: "started" | |
url: "http://example.com" | |
[ /1/#0 3fba6baf-8125-4f7c-8c1b-8f687d8a22d3 17:05:44.321330Z | |
action_type: "download" | |
action_status: "started" | |
url: "http://example.com" |
This file contains 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
# my_effect.py | |
""" | |
In normal code, side-effecty code is run as usual. | |
In tests one can (with a context manager, perhaps) disable side-effects and figure out | |
what the intention of the code is without actually triggering any side-effects. | |
""" | |
class IEffect(Interface): | |
def run(): |
This file contains 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
------------------------------------------------------------ | |
/home/itamar/.local/bin/pip-3.3 run on Sat Jan 11 19:15:31 2014 | |
Downloading/unpacking svn+ssh://[email protected]/svn/Twisted/branches/python3-setup-6539 | |
Checking out svn+ssh://[email protected]/svn/Twisted/branches/python3-setup-6539 to ./pip-qk0ee4-build | |
Found command 'svn' at '/usr/bin/svn' | |
Running command /usr/bin/svn checkout -q --username itamarst svn+ssh://[email protected]/svn/Twisted/branches/python3-setup-6539 /tmp/pip-qk0ee4-build | |
Running setup.py egg_info for package from svn+ssh://[email protected]/svn/Twisted/branches/python3-setup-6539 |