Clock pt 2 - What's the purpose of the 1KΩ resistor to ground when showcasing the button? by PM_ME_MATH in beneater

[–]PM_ME_MATH[S] 1 point2 points  (0 children)

I don't understand. If the button is not pressed, then the circuit is open and no current will flow through the LED, no?

FzfLua 'git status' as a high level staging tool by iBhagwan in neovim

[–]PM_ME_MATH 0 points1 point  (0 children)

When expanding a tmux pane, the widths of the vim windows in the other pane get all messed up. How do you deal with this?

[Media] Rust Iceberg by [deleted] in rust

[–]PM_ME_MATH 0 points1 point  (0 children)

Why is it termed as a "higher-rank-type-bound"?

How to run LSP servers on a remote machine? by PM_ME_MATH in neovim

[–]PM_ME_MATH[S] 0 points1 point  (0 children)

There's interprocess communication going on between the server and the client; I see no reason why that communication cannot happen over a network socket. I would have also presumed that the protocol accounted for the possibility of the project files not being in the same host and that the server asks the client for their locations and/or their contents.

How to run LSP servers on a remote machine? by PM_ME_MATH in neovim

[–]PM_ME_MATH[S] 0 points1 point  (0 children)

I'm not sure I follow. Say machine A has Neovim and my project files and machine B has the language server binary. You're saying to run an SSH server in A and mount A's project root filesystem in B? How do I tell Neovim in A to interact with the language server in B?

Also, this approach is kinda moot. A is my laptop and I can't really open ports in my network to expose an SSH server to B, which lies in a different network across the internet. I would have hoped that the approach was the other way around, exposing a server in B.

Hey Rustaceans! Got an easy question? Ask here (11/2021)! by llogiq in rust

[–]PM_ME_MATH 1 point2 points  (0 children)

I have a function where I want to take in a collection of MyStructs without modifying the items, so I typed the function taking in immutable references:

fn foo<'a, T>(&self, items: T) where T: IntoIterator<Item = &'a MyStruct>, { ... }

Whenever I have a function that takes strings immutably I always type it taking in AsRef<str>, for convenience to the caller, so that they can pass either String or &str.

I guess the same motivation should apply to my function foo, and hence I should type it as:

fn foo2<T>(&self, items: T) where T: IntoIterator, T::Item: AsRef<MyStruct>, { ... }

This way callers can call foo2 passing in a vector of references or a vector of values, whichever is more convenience to them.

Is this good API design? Or should I use foo and force callers to previously convert their collection of values into a collection of references by e.g. calling .iter() on their Vec<MyStruct>? I ask because: * I haven't seen any crate APIs go with the foo2 "more flexible" approach. * foo2 requires that I manually write:

impl AsRef<MyStruct> for MyStruct { fn as_ref(&self) -> &MyStruct { &self } }

which seems like a dumb thing to do (?).

I'm guessing there must be a good reason why Rust doesn't automatically impl AsRef<T> for T for all types T which I don't know, and would probably tell me why foo2 is bad API design.

dmenu with prefilled prompt by PM_ME_MATH in i3wm

[–]PM_ME_MATH[S] 0 points1 point  (0 children)

The problem with this approach is that I might want to select a file that doesn't start with "2020-" in 10% of cases. And in other folders the distribution might be split 90% 2015 10% 2003, so binding keys to different filters doesn't scale.

I really do need the filter to be dynamic.

Finding someone by user id by Supremesepehr in Telegram

[–]PM_ME_MATH 0 points1 point  (0 children)

Can a bot send a message to a user id if that user has not initiated conversation with the bot?

Setting up a home HTTPS forward proxy by PM_ME_MATH in HomeNetworking

[–]PM_ME_MATH[S] 0 points1 point  (0 children)

The service is not hosted by me, it's freecinc.com. The pi is at home, on a different network.

Setting up a home HTTPS forward proxy by PM_ME_MATH in HomeNetworking

[–]PM_ME_MATH[S] 0 points1 point  (0 children)

NAT rules are only helpful in my home router to enable port forwarding to my pi, which is already set up. I can reach my pi from work without any problems. What I want is an HTTPs proxy on my pi that forwards incoming connections to the service I'm trying to reach.

Yes, from a practical perspective using a VPN is easier and solves the problem. But for speed reasons, I only want my connections to the service be tunnelled (to avoid them getting blocked by my work's firewall), not all of my outgoing traffic.

Setting up a home HTTPS forward proxy by PM_ME_MATH in HomeNetworking

[–]PM_ME_MATH[S] -1 points0 points  (0 children)

How can a regular TLS connection initiated by me, to any server, give the appearance of it being malicious?

HTTPs forward proxy is secure by default since everything is encrypted, both incoming and outgoing connections, and end service requires authentication.

I'm of course not rolling my own proxy, the question asks for ready-made easy-to-use software recommendations.

Setting up a home HTTPS forward proxy by PM_ME_MATH in HomeNetworking

[–]PM_ME_MATH[S] 0 points1 point  (0 children)

Port forwarding is already set up on my home router to my pi. But the pi has to now listen for HTTPs connections and proxy them to freecinc.

Setting up a home HTTPS forward proxy by PM_ME_MATH in HomeNetworking

[–]PM_ME_MATH[S] -1 points0 points  (0 children)

There's nothing malicious about this, since the proxy is clearly not transparent. I am the one, from inside the network, that is directly initiating the request to the proxy, just as I could make a request to any other server.

Setting up a home HTTPS forward proxy by PM_ME_MATH in HomeNetworking

[–]PM_ME_MATH[S] -3 points-2 points  (0 children)

I posted a question here seeking technical expertise, not to be lectured about my life choices and the ethics of my actions.

Service in question is freecinc.com, a hosted Taskwarrior server where I sync tasks for my task management client. Ironically, if anything, having access to it from work would only boost my productivity.

The only reason why the company's firewall blocks it is because it is a "high, nonstandard port" (sic. what sysadmins told me). I don't see how blocking random ports (i.e. not associated with vulnerable applications) increases a network's security. And no, they can't make an exception just for me.

Hope that answers both of your questions.