Aliasing grep in find’s -exec option

I have these aliases in my ~/.bashrc

alias grep='grep --color=auto -H'
alias fgrep='fgrep --color=auto -H'
alias egrep='egrep --color=auto -H'

but they have no effect when I run find ... -exec grep ..., and I always have to provide those options manually.

Is there a way to tell find to rely on aliases in the -exec option’s arguments? I’m thinking of configuration files, rather than other aliases.

Would it be unsafe in some way?

Go to Source
Author: Enrico Maria De Angelis

Dualboot problem with windows 10 and ubuntu in MSI

I have installed windows 10 and ubuntu 20.04 on my laptop, in general it seems that everything works fine.
The problem I observe, is when I’m in ubuntu, and I reboot to enter windows, there are configurations that are reset, like configurations with the graphic card (nvidia), sound card or wifi.

Similarly, when I’m in windows and I switch to ubuntu, the first time I log in, the wifi card never works in ubuntu, I have to reboot twice for ubuntu to detect it…

I was reading that this may be due to the UEFI configuration, which should be using legacy mode. Should I format the disk, switch modes, and reinstall windows + ubuntu?

Also, in other computers I’ve had, I used to have problems changing the time, when I changed OS, but in this case, I find it curious to observe that not only the hour changes but also the minutes, I don’t know if it’s something also rare.

I’ve put all the problems together because I don’t know if they are all due to the same mistake…

Thank you very much in advance

Pablo

Go to Source
Author: Pablo MorPal

Can a router be configured from outside the local network?

My router can be configured by going to 192.168.1.1:80 when connected either by WiFi or by Ethernet cable.
Can the same configuration web interface be accessed from the external interface (the public IP of the router)?

Some background:
I have a “Technicolor TD5130” and I wanted to change the default password that the ISP preconfigures. But even after changing the password, the default weak password for some weird reason still works. So I’m wondering if someone can access the router configuration if they can’t initially connect to the router through Ethernet nor WiFi.

Go to Source
Author: RationalFragile

Postfix and Dovecot – No encryption on SMTP

currently I’m working on my veary own mailserver but as for now I can’t get SMTP up correctly.
I use Dovecot with postfix.
When I try to ad my server to my mail client it tells me:
Outgoing: SMTP (my servers address):587, No SSL, Authentification: Normal password

I don’t know why I get this result since I thought I had everything set up.
I have no experience with postfix till today so I have no idea whats missing or wrong.
Here is my postfix main.cf: https://pastebin.com/S17jWDQd
Here is my dovecot.conf: https://pastebin.com/tMD90Znn
Most of these contents are copied from an iRedMail installation so I think I missed something while copying and modifying for my own use.

Thank you!

Go to Source
Author: BDevGW

Load single module based on configuration using dependency injection

I’m working on an application that will run on multiple systems and may use different modules to communicate with external systems, but on each system, only one module will be used at a time. As it should be possible to change the used module on a specific system, the same application with all modules should be deployed to all systems. For simplicity, let’s assume that there are two modules called Foo and Bar.

Both modules have their own module descriptor that registers the module components to the dependency injection container:

public class FooModule : IModule
{
    public void Configure(IServiceCollection services)
    {
        services.AddTransient<IService, FooService>();
        // Register dependencies of FooService
    }
}

I know that Autofac supports modules out of the box (even with support for configuration) and there are several libraries that add such a feature to Microsoft.Extensions.DependencyInjection, but I want to ask this question with a general look at the concept of dependency injection.

If the services of all modules should be used at the same time, I would be done. Given they implement the same service, I could inject them using IEnumerable<IService>. But in my use case, there is a component that requires a single IService and I want to select the implementation based on a configuration (e.g. from a file).

Now there are several approaches where to apply that configuration and I’m not sure which one should be preferred:

1st approach – load single assembly

I could read the configuration and then load only the external assembly that contains the IModule that should be used. This would require the introduction of some “magic” link between the configuration values and the names of the module assemblies, as the core application should not know the extension modules beforehand.

2nd approach – call single module

All the assemblies are loaded, but using a link between the configuration values and the names of the module classes (or namespaces), only the one module that should be used will be called to setup the passed IServiceCollection.

3rd approach – let the module decide

The modules decide on their own if they are configured and therefor should provide their service implementation. Instead of evaluating the configuration in the core application, the configuration gets passed to the modules:

public class FooModule : IModule
{
    public void Configure(IServiceCollection services, IConfiguration configuration)
    {
        if (configuration.GetSection("foo").Exists())
        {
            services.AddTransient<IService, FooService>();
        }
    }
}

4th approach – use some DI container feature

I know that Autofac or other DI containers support named / keyed service registrations that would basically solve this problem and therefor answer this question for me. However, I guess there is a reason why other DI containers like Microsoft.Extensions.DependencyInjection do not provide this feature.


What approach would you prefer? Is there an approach or some variation that I missed? Is there anything else I should keep in mind when designing a system in that way?

Go to Source
Author: Lukas K├Ârfer