How to start with google bigquery
Here is the list of thing I noticed when started to work with bigquery. First you need to create a project — https://cloud.google.com/bigquery/docs/quickstarts/quickstart-web-ui. That’s how you create a service key for bigquery — https://cloud.google.com/docs/authentication/getting-started. Select your project on the very top of the page, and then create JSON key. And don’t forget to set is …
Interesting alternative to grpc_cli
https://github.com/ktr0731/evans It has REPL mode and CLI mode for e2e tests I think, it could be a good alternative to grpc_cli.
Go library for creating slack bots
You can use it like that:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
package main import ( "context" "github.com/shomali11/slacker" "log" ) func main() { bot := slacker.NewClient("<YOUR SLACK BOT TOKEN>") definition := &slacker.CommandDefinition{ Handler: func(request slacker.Request, response slacker.ResponseWriter) { response.Reply("pong") }, } bot.Command("ping", definition) ctx, cancel := context.WithCancel(context.Background()) defer cancel() err := bot.Listen(ctx) if err != nil { log.Fatal(err) } } |
https://github.com/shomali11/slacker
How to work with core dumps of Go programs
If you want to check what is going on in your service during load (on production or during stress testing process), you can take a core dump of your app and load it into Goland for further debugging.
1 2 3 4 5 6 |
# first you need to get your app's PID ps aux|grep <your-app-bin-name> gcore <PID> # download dump file and binary file to a local machine with kubectl cp <some-namespace>/<some-pod>:/core.<PID> ~/Downloads kubectl cp <some-namespace>/<some-pod>:<your-app-bin-path> ~/Downloads |
Then open it your Goland: Navigate to Run | Open Core Dump. In the Executable field, …
Nice introductory article on why Golang is not OOP
It is a copy of this article — https://rakyll.org/typesystem/ It is real struggle to work with a new language, especially if the type doesn’t resemble what you have previously seen. I have been there with Go and lost my interest in the language when it first came out due to the reason I was pretending …
How to install linux mint on hp
I’ve run into a problem — had a lot of error logging saying «PCIe Bus Error: severity=Corrected, type=Physical Layer», «AER Corrected error received», and similar. The problem is that it fills all the log space and the installation process cannot finish. You can run into it on HP laptops on monoblocks. What you can do.
How to watch tv on amazon Fire TV stick
You need to install some apps for that. Settings→My Fire TV→Developer options→Apps from Unknown Sources→ON. 🔍→Type «Downloader»→Click on it→Install. Home→Downloader→Type following link (https://smarttvnews.ru/wp-content/uploads/2017/03/LazyIPTV_2.44.apk)→Install. 🔍→Type «VLC Player»→Install. Home→Lazy IPTV→New playlist→From Internet(by url)→Type «https://smarttvnews.ru/apps/iptvchannels.m3u». Now you can watch it. Home→Lazy IPTV→Channel search→Select a channel you want. More on apps and playlists here — https://smarttvnews.ru/kak-besplatno-smotret-tv-kanalyi-na-android-ustroystvah-i-gde-skachat-besplatnyie-iptv-pleylistyi/ (in Russian).
Clean architecture pattern
The main idea is to have layers that only depend on inner layers (see images below). Let’s imagine you have a repository that includes several applications. Layers Domain (Entities) Has basic types and interfaces for your application. As well as common logic for your domain. Usecase Services, handlers, controllers, whatever we call them. Adapters Implementations …
A way to test http client in go
A couple of ways are described here — http://hassansin.github.io/Unit-Testing-http-client-in-Go The way I liked is the following one:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
func Test_Mine(t *testing.T) { ... client := httpClientWithRoundTripper(http.StatusOK, "OK") ... } type roundTripFunc func(req *http.Request) *http.Response func (f roundTripFunc) RoundTrip(req *http.Request) (*http.Response, error) { return f(req), nil } func httpClientWithRoundTripper(statusCode int, response string) *http.Client { return &http.Client{ Transport: roundTripFunc(func(req *http.Request) *http.Response { return &http.Response{ StatusCode: statusCode, Body: ioutil.NopCloser(bytes.NewBufferString(response)), } }), } } |
Go internals
Channels https://youtu.be/KBZlN0izeiY Go scheduler https://youtu.be/YHRO5WQGh0k