Skip to content

Instantly share code, notes, and snippets.

View mtfelian's full-sized avatar

Artemii Shepelev mtfelian

View GitHub Profile
@sharkyak
sharkyak / gist:934100d229232864fd0d5d715a1acd38
Created December 17, 2020 12:44
elasticsearch count records with conditions and range
GET /filebeat-*/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"host.hostname": {
"value": "mail"
}
@ribice
ribice / caller.go
Last active January 6, 2025 07:14
A robust rabbitmq client for Go
go func() {
for {
err = rmq.Stream(cancelCtx)
if errors.Is(err, rabbitmq.ErrDisconnected) {
continue
}
break
}
}()
@up1
up1 / 1.go
Last active September 8, 2022 21:10
Go Tracing + OpenTelemetry
func producer(ctx context.Context) {
tr := global.TraceProvider().Tracer("component-producer")
_, span := tr.Start(ctx, "producer")
defer span.End()
// Get tracing id and Parent span id
traceId := fmt.Sprintf("%016x", span.SpanContext().TraceID)
spanId := fmt.Sprintf("%016x", span.SpanContext().SpanID)
// Add to message
@martin-helmich
martin-helmich / docker-compose.yml
Created January 11, 2020 10:52
Minimal example for using Jaeger Tracing with Go
version: "3"
services:
jaeger:
image: jaegertracing/all-in-one:1.8
ports:
- 6831:6831/udp
- 6832:6832/udp
- 5778:5778
- 16686:16686
- 14268:14268
@SandeepThomas
SandeepThomas / socket.service.ts
Created November 15, 2018 11:04
Angular RxJs Websocket
import { Injectable } from '@angular/core';
import { fromEvent, NextObserver, Observable, Subject, Subscription, timer } from 'rxjs';
import { _throw } from 'rxjs/observable/throw';
import { finalize, mergeMap, retryWhen, take } from 'rxjs/operators';
import { WebSocketSubject } from 'rxjs/webSocket';
import { environment } from '../../../environments/environment';
import { AuthService } from './authentication.service';
@Injectable()
export class SocketService {
@gannebamm
gannebamm / docker-compose.yml
Created October 16, 2018 12:02
docker-compose file for geonetwork postgres geoserver stack
# GeoNetwork
#
# Access via "http://localhost:8080/geonetwork" (or "http://$(docker-machine ip):8080/geonetwork" if using docker-machine)
#
# Default user: admin
# Default password: admin
version: '3.1'
services:
@davecheney
davecheney / go1.0-vs-go1.11.txt
Created October 7, 2018 11:13
test/bench/go1 benchmark results
name old time/op new time/op delta
BinaryTree17 5.44s ± 2% 3.27s ± 2% -39.90% (p=0.000 n=20+19)
Fannkuch11 4.95s ± 2% 2.68s ± 2% -45.87% (p=0.000 n=20+20)
FmtFprintfEmpty 142ns ± 2% 49ns ± 3% -65.39% (p=0.000 n=20+18)
FmtFprintfFloat 765ns ± 2% 260ns ± 2% -66.02% (p=0.000 n=20+20)
FmtFprintfInt 341ns ± 2% 95ns ± 2% -72.08% (p=0.000 n=19+20)
FmtFprintfIntInt 554ns ± 2% 150ns ± 1% -72.95% (p=0.000 n=20+19)
FmtFprintfPrefixedInt 497ns ± 3% 178ns ± 3% -64.12% (p=0.000 n=20+20)
FmtFprintfString 466ns ± 2% 86ns ± 3% -81.54% (p=0.000 n=20+20)
FmtManyArgs 2.23µs ± 2% 0.59µs ± 1% -73.46% (p=0.000 n=20+17)
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active October 14, 2025 12:11
set -e, -u, -o, -x pipefail explanation
@borekb
borekb / README.md
Last active September 23, 2025 19:19
Docker and Git Bash / MSYS2 on Windows: path conversion workaround

👋 Moved to https://github.com/borekb/docker-path-workaround


Docker in Git Bash / MSYS2 on Windows: path conversion workaround

UPDATE 07/2018: I switched from Git Bash to MSYS2 recently which should be very similar, if not the same, but there some subtle differences which made me realize this is more tricky than I thought and that I don't 100% understand what is going on. If someone can help, please let me know in the comments.

Invoking docker in MSYS2 shell or Git Bash typically fails with complains about paths, for example:

@peterbsmyth
peterbsmyth / recipe.example.md
Last active May 21, 2020 13:39
Making chained API Calls using @ngrx/Effects

Making chained API Calls using @ngrx/Effects

Purpose

This recipe is useful for cooking up chained API calls as a result of a single action.

Description

In the below example, a single action called POST_REPO is dispatched and it's intention is to create a new repostiory on GitHub then update the README with new data after it is created.
For this to happen there are 4 API calls necessary to the GitHub API:

  1. POST a new repostiry
  2. GET the master branch of the new repository
  3. GET the files on the master branch