Here are a couple of choices, from reasonable (i) to pointless (ii) to potentially incorrect (iii) to absurd (iv) ~ (ix).
d = {}
k = object()
# i.
Reading symbols from python3... | |
Breakpoint 1 (-function malloc) pending. | |
Breakpoint 2 (-function tuple_alloc) pending. | |
Breakpoint 3 (-function npy_alloc_cache) pending. | |
[Thread debugging using libthread_db enabled] | |
Using host libthread_db library "/usr/lib/libthread_db.so.1". | |
[New Thread 0x7ffff43a8640 (LWP 96530)] | |
[New Thread 0x7ffff3ba7640 (LWP 96531)] | |
[New Thread 0x7fffe33a6640 (LWP 96532)] | |
[New Thread 0x7fffdaba5640 (LWP 96533)] |
id(xs) = 0x7f9b_5e1a_82b0 xs.__array_interface__["data"][0] = 0x556b_581f_c4d0 id(t) = 0x7f9b_5e28_a580 args.size = 1 | |
id(xs) = 0x7f05_d486_14e0 xs.__array_interface__["data"][0] = 0x55e1_12fa_a4d0 id(t) = 0x7f05_d495_1580 args.size = 1 | |
id(xs) = 0x7f1d_574f_f8f0 xs.__array_interface__["data"][0] = 0x55c8_86a5_24d0 id(t) = 0x7f1d_58a7_1580 args.size = 1 | |
id(xs) = 0x7f10_58e9_e300 xs.__array_interface__["data"][0] = 0x55ee_d01f_d4d0 id(t) = 0x7f10_58f8_0580 args.size = 1 | |
id(xs) = 0x7fb4_ddb3_0260 xs.__array_interface__["data"][0] = 0x5653_496d_64d0 id(t) = 0x7fb4_ddc1_1580 args.size = 1 | |
id(xs) = 0x7f68_602d_5530 xs.__array_interface__["data"][0] = 0x55b7_215a_f4d0 id(t) = 0x7f68_603c_7580 args.size = 1 | |
id(xs) = 0x7f1d_b0f8_2300 xs.__array_interface__["data"][0] = 0x558a_0542_d4d0 id(t) = 0x7f1d_b106_4580 args.size = 1 | |
id(xs) = 0x7f90_51dd_5260 xs.__array_interface__["data"][0] = 0x557b_cef8_d4d0 id(t) = 0x7f90_51eb_6580 args.size = 1 | |
id(xs) = 0x7f9c_fb91_2850 xs.__array_interface__["data"][0] = 0x5580_e397_94d0 i |
#!/usr/bin/env python3 | |
from matplotlib.pyplot import show | |
from pandas import read_csv, to_numeric, DataFrame | |
from collections import namedtuple | |
class Analysis(namedtuple('Analysis', 'raw df')): | |
TUP_PATTERN = r'id\(t\) = (?P<addr>0x[\da-z_]+)' | |
NDARR_PATTERN = r'xs.__array_interface__\["data"\]\[0\] = (?P<addr>0x[\da-z_]+)' | |
@classmethod |
(require 'package) | |
(package-initialize) | |
(add-to-list 'package-archives | |
'("melpa" . "https://melpa.org/packages/")) | |
; (add-to-list 'package-archives | |
; '("elpy" . "https://jorgenschaefer.github.io/packages/")) | |
; (add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp") | |
; (add-to-list 'load-path "~/.emacs.d/site-lisp/mdboom_gh") | |
(add-to-list 'load-path "~/.emacs.d/site-lisp/ox-rst") |
#!/usr/bin/env python3 | |
from networkx import DiGraph | |
from networkx.drawing.nx_pydot import to_pydot | |
from contextlib import contextmanager | |
from sys import setprofile | |
from collections import namedtuple | |
class Ident(namedtuple('IdentBase', 'filename lineno name')): | |
def __str__(self): |
#!/usr/bin/env python3 | |
from nwis import dwim | |
@dwim | |
def func(x, y): | |
return x @ y | |
if __name__ == '__main__': | |
print(f'func(1, 2) = {func(1, 2)}') |
.PHONY: test clean | |
test: | |
seq 1 10 > seq1 | |
seq 10 20 > seq2 | |
mkdir -p dir | |
seq 20 30 > dir/seq3 | |
python git-init+add+commit.py seq1 seq2 dir/seq3 || (git init . ; git add seq1 seq2 dir ; git commit -am 'first commit') | |
git status | |
git log |
from __future__ import annotations | |
from inspect import signature | |
from functools import wraps | |
from collections import namedtuple | |
opt = namedtuple('Optional', '')() | |
def better_defaults(f): | |
sig = signature(f) | |
@wraps(f) | |
def func(*args, **kwargs): |
from numpy.random import random | |
from numpy import array, isclose, zeros_like, sign | |
from numpy.linalg import lstsq | |
def solve(func, values, atol=0.1): | |
while True: | |
result = func(values) | |
if isclose(result, 0, atol=atol): | |
break | |
values -= sign(result) * random(values.size) |