Skip to content

Commit 50f0413

Browse files
committed
trim todo
1 parent 5a815ec commit 50f0413

File tree

2 files changed

+3
-220
lines changed

2 files changed

+3
-220
lines changed

feed.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<title>This blog now has an Atom feed, and yours should probably too</title>
8585
<link href="https://gaultier.github.io/blog/feed.html"/>
8686
<id>urn:uuid:1f4df7db-eea8-5ef0-ae92-1038111f5dc9</id>
87-
<updated>2025-03-04T20:27:05+01:00</updated>
87+
<updated>2025-09-17T09:33:23+02:00</updated>
8888
<published>2023-12-15T12:23:43+01:00</published>
8989
</entry>
9090

@@ -100,7 +100,7 @@
100100
<title>Quick and easy PNG image size reduction</title>
101101
<link href="https://gaultier.github.io/blog/image_size_reduction.html"/>
102102
<id>urn:uuid:1cd73d67-ad32-5cdc-93a7-f4046d7cd4a5</id>
103-
<updated>2025-07-07T16:51:52+02:00</updated>
103+
<updated>2025-09-17T09:33:23+02:00</updated>
104104
<published>2024-02-23T11:27:43+01:00</published>
105105
</entry>
106106

@@ -244,7 +244,7 @@
244244
<title>Making my static blog generator &lt;del&gt;11&lt;/del&gt; 33 times faster</title>
245245
<link href="https://gaultier.github.io/blog/making_my_static_blog_generator_11_times_faster.html"/>
246246
<id>urn:uuid:d29b6ec2-f895-5f2f-896f-2f343766fc85</id>
247-
<updated>2025-07-07T17:51:49+02:00</updated>
247+
<updated>2025-09-17T09:33:23+02:00</updated>
248248
<published>2025-02-19T15:13:54+01:00</published>
249249
</entry>
250250

todo.md

Lines changed: 0 additions & 217 deletions
Original file line numberDiff line numberDiff line change
@@ -22,223 +22,6 @@
2222
+ some less than optimal encodings are forced to avoid accidentally using RIP relative addressing, e.g. `lea rax, [r13]` gets encoded as `lea rax, [r13 + 0]`
2323
- [ ] How to get the current SQL schema when all you have is lots of migrations (deltas)
2424
- [ ] Search and replace fish function
25-
- [ ] Go+Dtrace: Tips
26-
```
27-
pid$target::*DispatchMessage:entry {
28-
stack_offset =656;
29-
this->data=copyin(uregs[R_SP] + stack_offset, 16);
30-
tracemem(this->data, 16);
31-
32-
this->body_len = *((ssize_t*)this->data+1);
33-
34-
this->body_ptr = (uint8_t**)this->data;
35-
36-
this->s = copyinstr((user_addr_t)*this->body_ptr, this->body_len);
37-
printf("msg.body: %s\n", this->s);
38-
}
39-
```
40-
41-
```
42-
$ sudo dtrace -n 'pid$target::github.com?ory?kratos*SMSBody:return{ this->body_len = uregs[1]; this->body_ptr = (uint8_t*)uregs[0];
43-
44-
this->s = copyinstr((user_addr_t)this->body_ptr, this->body_len);
45-
printf("msg.Body: %s\\n", this->s);
46-
}' -p $(pgrep -a kratos)
47-
```
48-
49-
50-
```
51-
52-
10 2968 github.com/ory/kratos/courier.(*courier).DispatchMessage:entry
53-
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
54-
0: 80 ae c7 01 40 01 00 00 1e 00 00 00 00 00 00 00 ....@...........
55-
msg.Body: Your recovery code is: 707144
56-
```
57-
58-
```shell
59-
$ sudo dtrace -x flowindent -n 'pid$target::*createBrowserRecoveryFlow*:entry {this->trace=1;} pid$target::*selfservice*:entry,pid$target::*selfservice*:return /this->trace/ {} pid$target::*createBrowserRecoveryFlow*:return {this->trace=0;} ' -p $(pgrep -a kratos)
60-
dtrace: description 'pid$target::*createBrowserRecoveryFlow*:entry ' matched 3602 probes
61-
CPU FUNCTION
62-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Handler).createBrowserRecoveryFlow-fm
63-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Handler).createBrowserRecoveryFlow
64-
10 -> github.com/ory/kratos/selfservice/strategy/code.(*Strategy).RecoveryStrategyID
65-
10 <- github.com/ory/kratos/selfservice/strategy/code.(*Strategy).RecoveryStrategyID
66-
10 -> github.com/ory/kratos/selfservice/strategy/link.(*Strategy).RecoveryStrategyID
67-
10 <- github.com/ory/kratos/selfservice/strategy/link.(*Strategy).RecoveryStrategyID
68-
10 -> github.com/ory/kratos/selfservice/flow/recovery.Strategies.Strategy
69-
10 -> github.com/ory/kratos/selfservice/strategy/code.(*Strategy).RecoveryStrategyID
70-
10 <- github.com/ory/kratos/selfservice/strategy/code.(*Strategy).RecoveryStrategyID
71-
10 -> github.com/ory/kratos/selfservice/strategy/code.(*Strategy).RecoveryStrategyID
72-
10 <- github.com/ory/kratos/selfservice/strategy/code.(*Strategy).RecoveryStrategyID
73-
10 <- github.com/ory/kratos/selfservice/flow/recovery.Strategies.Strategy
74-
10 -> github.com/ory/kratos/selfservice/flow/recovery.NewFlow
75-
10 -> github.com/ory/kratos/selfservice/flow/recovery.NewFlow.SecureRedirectUseSourceURL.func1
76-
10 <- github.com/ory/kratos/selfservice/flow/recovery.NewFlow.SecureRedirectUseSourceURL.func1
77-
10 -> github.com/ory/kratos/selfservice/flow/recovery.NewFlow.SecureRedirectAllowURLs.func2
78-
10 <- github.com/ory/kratos/selfservice/flow/recovery.NewFlow.SecureRedirectAllowURLs.func2
79-
10 -> github.com/ory/kratos/selfservice/flow/recovery.NewFlow.SecureRedirectAllowSelfServiceURLs.func3
80-
10 <- github.com/ory/kratos/selfservice/flow/recovery.NewFlow.SecureRedirectAllowSelfServiceURLs.func3
81-
10 -> github.com/ory/kratos/selfservice/flow.AppendFlowTo
82-
10 <- github.com/ory/kratos/selfservice/flow.AppendFlowTo
83-
10 -> github.com/ory/kratos/selfservice/strategy/code.(*Strategy).NodeGroup
84-
10 <- github.com/ory/kratos/selfservice/strategy/code.(*Strategy).NodeGroup
85-
10 -> github.com/ory/kratos/selfservice/strategy/code.(*Strategy).PopulateRecoveryMethod
86-
10 <- github.com/ory/kratos/selfservice/strategy/code.(*Strategy).PopulateRecoveryMethod
87-
10 <- github.com/ory/kratos/selfservice/flow/recovery.NewFlow
88-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*HookExecutor).PreRecoveryHook
89-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*HookExecutor).PreRecoveryHook
90-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Flow).TableName
91-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*Flow).TableName
92-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Flow).TableName
93-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*Flow).TableName
94-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Flow).TableName
95-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*Flow).TableName
96-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Flow).TableName
97-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*Flow).TableName
98-
10 -> github.com/ory/kratos/selfservice/flow.(*State).Value
99-
10 <- github.com/ory/kratos/selfservice/flow.(*State).Value
100-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Flow).AfterSave
101-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Flow).SetReturnTo
102-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*Flow).SetReturnTo
103-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*Flow).AfterSave
104-
10 -> github.com/ory/kratos/selfservice/flow/recovery.(*Flow).AppendTo
105-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*Flow).AppendTo
106-
10 <- github.com/ory/kratos/selfservice/flow/recovery.(*Handler).createBrowserRecoveryFlow
107-
```
108-
109-
```
110-
$ sudo dtrace -n 'pid$target::*SendRecoveryCodeTo:entry {this->len = uregs[5]; this->ptr = uregs[4]; this->str = copyinstr(this->ptr, this->len); printf("Code: %s\n", this->str);} pid$target::*SendRecoveryCodeTo:return {trace(uregs[R_R0])}' -p $(pgrep -a kratos)
111-
```
112-
113-
```
114-
$ sudo dtrace -n 'struct flow {uint8_t pad1[136]; uint8_t* state_ptr; ssize_t state_len;}; pid$target::github.com?ory?kratos*GetRecoveryFlow:return {this->flow = (struct flow*)copyin(uregs[0],sizeof(struct flow)); this->state= copyinstr((user_addr_t)this->flow->state_ptr, this->flow->state_len ); trace(this->state);
115-
}' -p $(pgrep -a kratos)
116-
dtrace: description 'struct flow ' matched 2 probes
117-
CPU ID FUNCTION:NAME
118-
11 53391 github.com/ory/kratos/persistence/sql.(*Persister).GetRecoveryFlow:return choose_method
119-
```
120-
121-
```
122-
struct flow {
123-
uint8_t pad1[136];
124-
125-
uint8_t* state_ptr;
126-
size_t state_len;
127-
128-
uint8_t pad2[128];
129-
130-
uint8_t* payload_ptr;
131-
size_t payload_len;
132-
};
133-
134-
pid$target::github.com?ory?kratos*GenerateCode:return {
135-
this->body_len = uregs[1];
136-
this->body_ptr = (uint8_t*)uregs[0];
137-
138-
this->s = copyinstr((user_addr_t)this->body_ptr, this->body_len);
139-
printf("Code: %s\n", this->s);
140-
}
141-
142-
pid$target::github.com?ory?kratos*SendRecoveryCodeTo:entry {
143-
this->body_ptr = (uint8_t*)uregs[R_R4];
144-
this->body_len = uregs[R_R3];
145-
146-
this->s = copyinstr((user_addr_t)this->body_ptr, this->body_len);
147-
printf("Body: %s\n", this->s);
148-
}
149-
150-
151-
pid$target::github.com?ory?kratos*GetRecoveryFlow:return {
152-
this->flow = (struct flow*)copyin(uregs[0],sizeof(struct flow));
153-
154-
this->state= copyinstr((user_addr_t)this->flow->state_ptr, this->flow->state_len );
155-
trace(this->state);
156-
157-
if (this->flow->payload_ptr){
158-
this->payload= copyinstr((user_addr_t)this->flow->payload_ptr, this->flow->payload_len );
159-
trace(this->payload);
160-
}
161-
162-
ustack(10);
163-
}
164-
165-
pid$target::github.com?ory?kratos*UpdateRecoveryFlow:entry {
166-
this->flow = (struct flow*)copyin(uregs[R_R3],sizeof(struct flow));
167-
168-
this->state= copyinstr((user_addr_t)this->flow->state_ptr, this->flow->state_len );
169-
trace(this->state);
170-
171-
172-
if (this->flow->payload_ptr){
173-
this->payload= copyinstr((user_addr_t)this->flow->payload_ptr, this->flow->payload_len );
174-
trace(this->payload);
175-
}
176-
177-
178-
ustack(10);
179-
}
180-
181-
pid$target::github.com?ory?kratos*CreateRecoveryFlow:entry {
182-
this->flow = (struct flow*)copyin(uregs[R_R3],sizeof(struct flow));
183-
184-
this->state= copyinstr((user_addr_t)this->flow->state_ptr, this->flow->state_len );
185-
trace(this->state);
186-
187-
if (this->flow->payload_ptr){
188-
this->payload= copyinstr((user_addr_t)this->flow->payload_ptr, this->flow->payload_len );
189-
trace(this->payload);
190-
}
191-
192-
193-
ustack(10);
194-
}
195-
```
196-
197-
See all SQL queries:
198-
199-
```
200-
sudo dtrace -n 'pid$target::github.com?ory?pop?v6.Query.ToSQL:return {printf("%s\n", stringof(copyin(arg1,arg0)))}' -c './code.test -test.count=1 -test.v -test.run=Recovery'
201-
```
202-
- JS rand:
203-
```js
204-
const count = parseInt(process.argv[2])
205-
206-
for (let i=0;i<count;i++){
207-
const s = Math.random().toString(36);
208-
const n = parseInt(s.slice(2), 36)
209-
console.log(n);
210-
}
211-
212-
```
213-
214-
```js
215-
const count = parseInt(process.argv[2])
216-
217-
for (let i=0;i<count;i++){
218-
const n = Math.random();
219-
console.log(n);
220-
}
221-
```
222-
223-
```js
224-
const crypto = require('crypto');
225-
226-
const count = parseInt(process.argv[2])
227-
228-
229-
for (let i=0;i<count;i++){
230-
const randomBytes = new Uint8Array(4);
231-
crypto.getRandomValues(randomBytes)
232-
const n = randomBytes[0] | (randomBytes[1]<<8) | (randomBytes[2]<<16) | (randomBytes[3]<<24)
233-
console.log(n);
234-
}
235-
```
236-
237-
```gnuplot
238-
set terminal pngcairo size 800,600 enhanced font 'Arial,10'
239-
set output 'rand.png'
240-
plot '~/scratch/rand.txt' with dots
241-
```
24225

24326
## Blog implementation
24427

0 commit comments

Comments
 (0)