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 April 23, 2025 15:21
set -e, -u, -o, -x pipefail explanation
@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
@tubiz
tubiz / udemy-courses-download-using-cookies.md
Created November 27, 2017 13:37 — forked from barbietunnie/udemy-courses-download-using-cookies.md
Downloading Udemy videos with youtube-dl

Download Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.

# $ youtube-dl {course_link} --cookies {path_to_cookies_file}