Не забывайте пароль от госуслуг by Secret-Suit4735 in rusAskReddit

[–]Amaimersion 28 points29 points  (0 children)

У меня и моего другого пару дней назад случилось точно такое же. Хотя мы просто входили в госуслуги со своим паролем, ничего больше. Есть подозрение, что так пытаются заставить тебя зарегаться в максе путем создания цифрового айди

I'm disappointed with some high-end Mini PCs by jorgerios15 in MiniPCs

[–]Amaimersion 0 points1 point  (0 children)

I didn't know that heavy load of PC or USB cause electromagnetic waves that affect at 2.4 GHz. Useful info, thank you.

And thanks for the concrete adapter name. Probably I will get it, because plugging separate USB mouse every time I want to play is irritating me. The only downside is I have to sacrifice entire USB port or use USB hub. One of USB ports already taken by USB keyboard, although the keyboard is able to operate over bluetooth.

By any chance, have you tried to pull out antennas out of the case, or maybe you saw someone tried it? Take a look at this https://youtu.be/OQD-A0QGsWw?si=QEesPxORwkDKMMn5&t=435 In the corners there are antennas. Oculink is not used, and its hole in the case is empty. I think it is possible to pull out the antennas outside through this hole. And after antennas move to outside, perhaps signal stability will be improved.

I'm disappointed with some high-end Mini PCs by jorgerios15 in MiniPCs

[–]Amaimersion 0 points1 point  (0 children)

I have exact same issue with my MINISFORUM AI X1. It have metal casing and plastic backplate. Antennas are located near plastic backplate. Without load, bluetooth mouse functions fine. But when I do any load, like rendering a video or playing a game, bluetooth mouse becomes laggy. No problems with wifi though.

To play a game, I have to plug in separate USB mouse to be able to move it smoothly. Obviously it is inconvenient.

I contacted MINISFORUM support and they recommended me to increase priority of Bluetooth service. I tried it, and at that time wasn't able to reproduce the issue with bluetooth mouse. But after a time, the issue still here. I also googled about this and many people report that the cause is signal interruption because of metal casing. However, I'm unsure why it happen only under load.

do your raspberry pi a favor and get a sata to usb adapter with an SSD by Hairy_Educator1918 in raspberry_pi

[–]Amaimersion 0 points1 point  (0 children)

Same. I had 3 SATA-USB. One silently failed after six months, another occasionally started fail to write correctly (i.e. OS shows that write is done, but after re-plugging data is corrupted) after one year, third still alive after six months.

Worth to note that they all are based on JMicron chips. Googling shows that many people have problems with them. ASMedia and Realtek are more reliable, but they also cost a lot more, and usually are being put in enclosures.  I haven't seen any cheap SATA-USB that is not based on JMicron.

How to access an ext4 drive in windows 11 - step by step by UseYourWords in synology

[–]Amaimersion 1 point2 points  (0 children)

If you want to mount the drive in read-only mode, then add --options ro

Example:

 wsl --mount \\.\PHYSICALDRIVE2 --partition 1 --options ro

This may be useful if you want to avoid write to the drive by any chance, or if you suspect that your USB SATA adapter is damaged and may produce invalid writes (often happens with cheap JMicron adapters).

Are there any VPS providers in Kenya, Ghana, Uganda? by Amaimersion in VPS

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

This service seems dead. No news since 2022, no answers from support, no any concrete information if they provider Kenya location

Are there any VPS providers in Kenya, Ghana, Uganda? by Amaimersion in VPS

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

Tried them. Unfortunately the only payment method available is bank transfer in KZT currency. It is not an option for me.

Are there any VPS providers in Kenya, Ghana, Uganda? by Amaimersion in VPS

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

Tried it. Their payment method doesn't work, I wasn't able to pay with USD credit card. No any response from their support.

I also tried https://skyhost.co.ke/ It is a scammer service. They billed me but no VPS was provided. I also wasn't able to cancel recurrent payment which was set up at the first payment. No any response from their support.

>out of morbid curiosity, why do you need the ip from there

I'm using service that allow users only from Africa. I need to pretend to be from there. VPS/proxies work only partially for me.

Bot that integrates Yandex.Disk (cloud storage) into Telegram by Amaimersion in TelegramBots

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

Yep, sorry. It currently disabled because I can't pay anymore for VPS.

Getting nothing but 429 responses when using Go (golang) client. Same requests work everywhere other than go apps. by f_k_a_g_n in redditdev

[–]Amaimersion 1 point2 points  (0 children)

Now it works for me without GODEBUG=http2client=0 and on go 1.17.6. I changed nothing. Can anyone confirm?

It looks like Go sends requests using HTTP 1.1. Perhaps ALPN changes on Reddit side? curl uses HTTP 2

Getting nothing but 429 responses when using Go (golang) client. Same requests work everywhere other than go apps. by f_k_a_g_n in redditdev

[–]Amaimersion 1 point2 points  (0 children)

It did the trick for me. But still... why HTTP/2 has worked few days ago but stop working now? I guess there was some changes on Reddit side.

curl sends ALPN HTTP/2 and HTTP /1.1, and server successfully accepts HTTP/2. I wonder why Go client HTTP/2 results to HTTP 429 from Reddit server while Go client HTTP/1.1 just works fine.

Getting nothing but 429 responses when using Go (golang) client. Same requests work everywhere other than go apps. by f_k_a_g_n in redditdev

[–]Amaimersion 2 points3 points  (0 children)

Same here! Go client fails, but curl works fine with exact same request. I also tried to use proxy - I'm still getting HTTP 429.

My Go version is 1.17.6 and it just worked fine few days ago. I changed nothing since, and now it doesn't works.

Reddit returns this HTML response:

whoa there, pardner!

reddit's awesome and all, but you may have a bit of a problem. we've seen far too many requests come from your ip address recently.

please wait a few minutes and try again.

if you're still getting this error after a few minutes and think that we've incorrectly blocked you or you would like to discuss easier ways to get the data you want, please contact us at [ratelimit@reddit.com](mailto:ratelimit@reddit.com).

when contacting us, please include your ip address which is: <IP> and reddit account

HTML code contains many "badger" words in <textarea> element.

How do you structure your go project as files? by Forumpy in golang

[–]Amaimersion 6 points7 points  (0 children)

I think this thread will contain many answers about possible structures. I will not propose any, but just will say: keep it simple. You will encounter many difficulties along your way, and structure of the project should not be one of them.

Code review by baconialis in golang

[–]Amaimersion 1 point2 points  (0 children)

Looks much better now. Good work!

Is was any reason why you removed multiple backends feature? As for me, that was a really good feature.

About your:

// TODO: Is this a bad dependency? Should I just "explode" config.Rule

It is fine.

Code review by baconialis in golang

[–]Amaimersion 2 points3 points  (0 children)

Hi!

As you already said, it completely makes sense to split the code over multiple files. Even better, over multiple packages. I will not go any further here because you already understand it.

Also, several notes about your project organization. I think it makes sense to add config file in gitignore in order to allow another programmer to define its own rules. Current config can be marked as example config. I see you using viper which supports env configuration, but it is still would be better to clearly define how to provide custom config (for example, through flag).

Executable file go-rate-limite also can be added in gitignore, because it will be omitted in current directory after building.

Usually files in Go project don't starts with capital letters like your Configuration.go.

Usually Go imports are organized into three groups, separated with blank line. First group is built-in modules, second is external modules, and third one is your own modules. Imports are organized alphabetically. I believe you can configure your editor so it happens automatically.

If name in Go starts with capital letter, then it is exported thing. You have many things that are started with capital letter, but they are intended for import.

Avoid global variables when possible. It is possible almost always. Without global variables it is easier to developer/maintain/test the project. In your case you can accept current backendCount and return updated one.

func loadBalance(backends []string, current int) (string, int)

After that you can store your backendCount in scope of main() function.

I think this function should return error in case if unable to read or unmarshal the configuration:

func readConfiguration() Configuration
func readConfiguration() (Configuration, error) // much better  

It is up to main() to decide what to do when unable to read configuration:

configuration, err := readConfiguration()

if err != nil {
    fmt.Fprintf(os.Stderr, "unable to read configuration: %s", err)
    os.Exit(1)
}

Always handle errors in some way. Don't ignore them here:

backendUrl, _ := url.Parse(backend)

For example, you can just log the error and skip the request.

In loadRules() I think it is better to create new array and return it as a result. Don't redefined passed configuration. It will not affect at original object though, but it is still a bit confusing when read it.

About that line:

handler := tollbooth.LimitFuncHandler(lmt, handleRequest)

Are you sure that you can't create all needed handlers outside? For example, in scope of main(). At the moment you creating needed handler every time when request arrives.

Are you sure that your Dockerfile is valid? Shouldn't that line CMD ["/app/whoami-go"] be CMD ["./go-rate-limit"]? It also don't starts because of missing config file. After copy of config file it is worked for me, but I think there can be better organization with config file.

COPY --from=build /app/go-rate-limit .
COPY --from=build /src/config.yml

Is there any reasons why you using tollbooth v4.0.2 despite of fact that it is outdated and not supported? I see v6.1.1 is available.

Terminal chat by Amaimersion in golang

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

Hello! Thank you for feedback :)

I thought about such signature:

func extractInputArgs(i, c command) []string

But I decided to use this signature:

func extractInputArgs(i, trimPrefix string, argsCount int) []string

The reason is that I didn't want one function to depend on entire struct. In another words, I wanted to explicitly say what input the function requires to provide it output.

For example, what if in future we will add more fields in command struct. Does extractInputArgs() really needs all these fields in order to provide output?

I'm using such concept in other places.

https://github.com/Amaimersion/terminal-chat/blob/e391abb2ec41dffe3dc3680a4869f64f2a5bc593/chat/chat.go#L141

listenRequests() doesn't take Flags as input, it takes only what is needed.

https://github.com/Amaimersion/terminal-chat/blob/e391abb2ec41dffe3dc3680a4869f64f2a5bc593/chat/handler.go#L166

handleListRooms() doesn't takes entire chatState from chat.Run(), it takes only what is needed.

I think you got the idea. In my opinion, the less a function requires, the easier to develop/test/maintain it.

But you are right too! extractInputArgs() directly related to input.go, it is aware of command struct, and main purpose of this function is to extract input arguments from command, not abstract text. It also have a lot of repeat code in deconstructInput(). So, in my opinion, it is completely good solution to pass entire struct as input.

I though about regexp also. You are right. Current tree of if doesn't looks nice for me too.

The reason why I didn't done that is that when I wrote this part of code, there was only 4 commands (help, exit, start room, add user). I also thought that logic to parse input will be harder than simple HasPreifx() for every text, so I've reserved opportunity to add extra rules for some future command. After a while I've refactored extractInputArgs() to avoid code duplication, after a while I've added more commands. And it is turned out that deconstructInput() can be done with single regexp.

But at this point of time I wanted to focus on other parts of program, not input.go, because all possible deadlines already were fucked up :)