How to install certbot on CentOS8
The biggest problem you faced is actually the following one
https://otodiginet.com/operating-system/how-to-install-snapd-on-centos-8/
and the article above answers the question very well.
.NET Core: Set the correct CurrentCulture basing the `lang` header
-
Create a middleware to do that task
public static void SetCurrentCulture(this IApplicationBuilder app) { app.Use(async (context, next) => { var cultureQuery = context.Request.Headers["lang"] == "en" ? "en-US" : "zh-CN"; if (!string.IsNullOrWhiteSpace(cultureQuery)) { var culture = new CultureInfo(cultureQuery); CultureInfo.CurrentCulture = culture; CultureInfo.CurrentUICulture = culture; } await next(); }); } -
Use the middleware in Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILog logger, IExceptionEntityService exceptionEntityService) { ... app.SetCurrentCulture(); ... }
Note: recover from accidentally changed the ownership of `sudo` command
Cause:
This morning, I change to the /backup directory and found I cannot write in it. So I rapidly typed sudo chown -R david:david .. then press Enter. You know what happened!
All the files in / directory were changing the owner to me! I realized this by seeing an error message like "You cannot change the owner of xxx file to david".
Damn, how silly I was! Unfortunately, that was not the end of my bad luck. When I try to revert it by typing sudo chown -R root:root /, I got another error message: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. Then I tried su - root but it seems that I haven't set a root password.
How can I recover my pop! OS?
- reboot it into single-user mode, edit the boot menu, add
systemd.unit=rescue.targetat the end of the boot line. - In the boot console,
chown -R root:root /usr; chmod 4755 /usr/bin/{sudo,dpkg,pkexec,crontab}; reboot
Rather easy, right? It did cost me over 10mins!
PS. I met many issues later after recovering from the accident. One of them is that the crontab command did not work as usual. I have to run the instruction below to fix it.
sudo apt reinstall cron
Linux is also fragile, please don't be such silly thing next time. I told myself.
PS: This time I also set a root password as well, so next time I could run su - root directly instead of going to the single user mode.
什么是AOP?这种在运行时,动态地将代码切入到类的指定方法、指定位置上的编程思想就是面向切面的编程。
什么是AOP?这种在运行时,动态地将代码切入到类的指定方法、指定位置上的编程思想就是面向切面的编程。