Skip to content

Instantly share code, notes, and snippets.

@gebv
gebv / README.md
Created March 7, 2021 00:32
sql queries mongodb - mongosqld

https://docs.mongodb.com/bi-connector/master/tutorial/ssl-setup/

./mongosqld --sampleNamespaces 'shared_storage.objects' --auth --mongo-username mongo --mongo-password mongo123 --sslMode requireSSL --sslPEMKeyFile ./bi.pem --sslCAFile ./mdbca.crt

mysql --ssl-mode REQUIRED --ssl-ca=./mdbca.crt --enable-cleartext-plugin --port 3307 -u mongo -pmongo123
@gebv
gebv / bufx.go
Created February 5, 2021 12:41
[draft code] manual buffer implementation io.Writer, io.WriterAt, io.Seeker, io.Reader, io.ReaderAt
package bufx
import (
"errors"
"io"
)
var (
_ io.Writer = (*buf)(nil)
_ io.WriterAt = (*buf)(nil)
@gebv
gebv / README.md
Created September 17, 2020 02:42
Embed resource files into your code via go generate command. This is a very simple solution to add the content of your files on the map[string][]byte. With a minimum of settings. Via bash script.

Quick start

  1. additional special comment in your code
...
//go:generate <path_to_bash_script> <file_name>
  1. run go generate ./
  2. should be created a new file in the same directory of the package (ending in _embeded.go)
@gebv
gebv / Makefile
Last active February 12, 2021 19:13
Proto gen
PROTOC_MAP ?= Mcommon/types.proto=github.com/<org>/<repo>/api/services/foobar_common
# protoc
PROTOC ?= docker run --rm -u ${shell id -u} \
-v ${PWD}:/defs namely/protoc-all:1.29_1 \
-l gogo \
--go-package-map ${PROTOC_MAP} \
--with-validator \
-o ./ \
-i ./proto
@gebv
gebv / consumer.go
Last active May 8, 2020 17:47
RabbitMQ reconnect with consumer and publisher (concept code)
package rmq
import (
"context"
"time"
"github.com/streadway/amqp"
"go.uber.org/zap"
)
@gebv
gebv / gist:639bfc5253d344a947e257c8e8852d04
Created March 25, 2020 01:30
gstreamer live streaming camera with audio to rtmp server
gst-launch-1.0 autovideosrc device=/dev/video0 \
! video/x-raw,width=1280,height=720 \
! queue \
! x264enc bitrate=2000 byte-stream=false key-int-max=60 bframes=0 aud=true tune=zerolatency pass=17 ! "video/x-h264,profile=main" \
! flvmux streamable=true name=mux \
! rtmpsink location="rtmp://127.0.0.1:1935/stream/test3 live=1" \
autoaudiosrc ! queue ! audioresample ! "audio/x-raw,rate=44100" ! queue ! mux.
@gebv
gebv / README.md
Last active January 23, 2020 15:23
Grafana with docker quick start (postgres storage)
mkdir -p grafana/provisioning # data sources and dashboards
> grafana.ini # grafana configs imports to docker
docker volume create --name=grafana-pg-storage
docker volume create --name=grafana-storage
docker-compose up -d
@gebv
gebv / settings.json
Created December 15, 2019 15:02
VSCode settings for golang (2019-12-15)
{
"workbench.colorTheme": "Monokai",
"editor.fontFamily": "Hack",
"editor.fontSize": 13,
"editor.accessibilitySupport": "auto",
// "go.gopath": "~/go",
// "go.useLanguageServer": true,
// "go.formatTool": "goimports",
@gebv
gebv / file1.csv
Last active July 18, 2019 13:27
Actual demo CSV
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 4.
kind,parameters with values
generated_at,2019-07-18T19:16:32+06:00
param_id,name,label,unit,type,is_enum,catalog_name,num_offers_by_param,value_id,raw_value,num_offers_by_value,used_in_categories
4850,,артикул,,,false,,5535,,,,"[050102 Губки-стиратели 050104 Запасные салфетки для губок 050105 Магнитные держатели 050203 Бейджи на шнурке, рулетке 050204 Шнурки и рулетки 050301 Демосистемы напольные 050401 Магнитно маркерные доски 050403 Клейкие доски 050406 Пробковые доски 05070301 Подставки настенные 060201 Ноутбуки 060203 Интернет-планшеты 06060109 Коммутаторы 06060110 Маршрутизаторы 06060112 Беcпроводное оборудование 06140101 Источники бесперебойного питания 06140102 Батареи для ИБП 06140201 Сетевые фильтры 06140202 Стабилизаторы напряжения 061403 Удлинители бытовые 06210201 Мониторы 062103 Моноблоки 06210401 Десктопы 06230102 Деловые программы 06240101 Электронные книги 07010202 Зарядные устройства сетевые 07010203 Внешние аккумуляторы 07011101 Защитные пленки для смартфонов 070116 Самоклеящиеся этикетки на