Nim's version of the Trojan Source vulnerability

2021-11-02 Thread benob
The more I look at this issue, the more I understand why it can't be solved at the language level (other than disallowing non-ascii characters). The levels of obfuscation you can reach with unicode identifiers are just silly.

Arraymancer: dot/matmul equivalent for higher-dim tensors

2021-11-01 Thread benob
I'd like to do this with dot, but also einsum only supports tensors of known dimension. For instance, my code cannot be passed a tensor of dim 4 or 5 (typically some DL routines like to abstract away the concept of batch an be able to process tensors with one extra dim for batch).

Nim's version of the Trojan Source vulnerability

2021-11-01 Thread benob
There is a more practical example in this go issue:

Nim's version of the Trojan Source vulnerability

2021-11-01 Thread benob
As described in let access_level = "user" if access_level != "user‮⁦# check if admin⁩ ⁦": echo "you are admin" else: echo "you are peon" Run Copy-paste the above code in a unicode-confo

Arraymancer: dot/matmul equivalent for higher-dim tensors

2021-10-30 Thread benob
Here is an example. import arraymancer let x = [[[1,2,3]]].toTensor() y = [[1,2],[3,4],[5,6]].toTensor() let c = einsum(x, y): x[i,j,k] * y[k,l] echo (x.shape, y.shape, c.shape) Run The resulting shapes are: x: [1, 1, 3] y:

Arraymancer: dot/matmul equivalent for higher-dim tensors

2021-10-30 Thread benob
The tensor multiplication operator in arraymancer `*` seems to only support multiplying matrices (tensors of dimension 2). Is there an equivalent of the implementation of dot() in numpy that supports higher dimension tensors and only multiplies the joint dimensions (typically last of first tens

Show Nim: Puppy - Easy HTTP(S) requests without DLLs, --d:ssl or cacerts.pem.

2021-03-04 Thread benob
This is really cool, I'll try it. Any plan for async?

Async stack traces referring to macros

2021-02-25 Thread benob
Is there a way to resolve where a macro was called in an async stack trace? Here is an example: nim /home/ubuntu/gemini/mine/gemini_server.nim(113) gemini_server /opt/nim/lib/pure/asyncdispatch.nim(1935) waitFor /opt/nim/lib/pure/asyncdispatch.nim(1627) poll /opt/nim

Patching existing libraries with "include"

2021-02-19 Thread benob
I will do that. Actually, the net/asyncnet api is out of sync in many places. I might extend that to a few more commits.

Nim 1.2.10 RC and 1.4.4 RC

2021-02-19 Thread benob
Is there a way to test them with choosenim?

Conjunctions of sum type parameters

2021-02-18 Thread benob
Thanks, that's helpful.

Conjunctions of sum type parameters

2021-02-18 Thread benob
I am playing with sum type parameters, and I'd like to specify types for parameters that play well together. For instance, I have a function that can take types (A, C) or (B, D) but I don't wont (A, D) or (B, C) to be valid. With sum types, f(A|B, C|D) makes every combo valid. Is there a way to

Patching existing libraries with "include"

2021-02-18 Thread benob
I am trying to go around an issue with the standard lib keeping an object member private (. In order to do that, I abuse "include" to patch the library: # file patched_net.nim include net ...define new functions that I miss

AsyncSocket timeout

2021-02-16 Thread benob
Good to know.

AsyncSocket timeout

2021-02-14 Thread benob
Thanks, exactly what I was looking for.

AsyncSocket timeout

2021-02-14 Thread benob
Is there an easy way to set timeouts with asyncsockets? I found this discussion but the approach is rather convoluted:

SSL: how to inspect and manually accept an unknown self-signed certificate?

2021-02-11 Thread benob
After fiddling quite a bit, I have succeeded in handling self-signed certificates in <https://github.com/benob/gemini>. There were multiple tricks: * Always activate certificate checking with SSL_VERIFY_PEER (client and server). * make sure the TLS handshake is finished before readi

SSL: how to inspect and manually accept an unknown self-signed certificate?

2021-02-09 Thread benob
. Values such as X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT or X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN indicate a self-signed certificate. Here is a POC that does not use net/asyncnet: <https://gist.github.com/benob/72d3a2fdefca3a586aa3dd6400892080> [1] <https://www.openssl.org/docs/man1

Why is AsyncSocketDesc private while SocketImpl is public?

2021-02-08 Thread benob
I'll create an issue, since the api is also a bit different between net and asyncnet in term of ssl handling. I need to get a bit familiar with the code and the impact of the modifications before proposing a PR.

SSL: how to inspect and manually accept an unknown self-signed certificate?

2021-02-08 Thread benob
Thanks, I'll explore those options. Since I am also working on a gemini implementation, we could join efforts :D

SSL: how to inspect and manually accept an unknown self-signed certificate?

2021-02-07 Thread benob
that its identity has not changed when returning later. * As a server, be able to identify peers that use self-signed certificates. Here is a minimal server example: <https://gist.github.com/benob/f236f997b80c2664a757b79c988c0cd1> To connect as a client, use "openssl s_client -c

asynchttpserver, keep-alive and concurrent queries

2021-02-06 Thread benob
Thank you for help, and sorry to bother you with my bugs.

Why is AsyncSocketDesc private while SocketImpl is public?

2021-02-05 Thread benob
Both structures are defined here: I would like to access sslHandle in an async context

What's the preferred way to compile nim to WebAssembly?

2021-01-18 Thread benob
I have been using this: and that:

asynchttpserver, keep-alive and concurrent queries

2020-11-24 Thread benob
ending while keeping connections alive? Here is my implementation: <https://gist.github.com/benob/63e6570685e16d6216ad7e41cb2a6c73> To reproduce the problem, put an html file which refers to many images (and images) in "public/"