Skip to content

Instantly share code, notes, and snippets.

View AntonSmolkov's full-sized avatar

Anton Smolkov AntonSmolkov

  • Saint-Petersburg
View GitHub Profile
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading.Channels;
var lockObject = new object();
var blockingCollection = new BlockingCollection<int>(10);
var channel = Channel.CreateBounded<int>(new BoundedChannelOptions(10) {SingleReader = true});
var cts = new CancellationTokenSource();
cts.CancelAfter(30000);
@AntonSmolkov
AntonSmolkov / gist:10a10cb1749d16418f71419f31cc6209
Created July 12, 2021 11:02
vector.dev fluent source issue log
Jul 12 13:25:14.930 DEBUG source{component_kind="source" component_name=fluent_source component_type=fluent}:connection{peer_addr=x.x.x.x}: vector::sources::util::tcp: Connection closed.
Jul 12 13:25:15.069 DEBUG source{component_kind="source" component_name=fluent_source component_type=fluent}:connection{peer_addr=x.x.x.x}: vector::sources::util::tcp: Connection closed.
Jul 12 13:25:15.074 DEBUG source{component_kind="source" component_name=fluent_source component_type=fluent}:connection{peer_addr=x.x.x.x}: vector::sources::util::tcp: Connection closed.
Jul 12 13:25:15.076 DEBUG source{component_kind="source" component_name=fluent_source component_type=fluent}:connection{peer_addr=x.x.x.x}: vector::sources::util::tcp: Connection closed.
Jul 12 13:25:15.136 TRACE source{component_kind="source" component_name=fluent_source component_type=fluent}:connection{peer_addr=x.x.x.x}: vector::internal_events::fluent: Received fluent message. byte_size=1350
Jul 12 13:25:15.136 TRACE source{component_kind="source" compon
echo '{"mydummy": "json"}' | gzip | curl -i --data-binary @- -H "Content-Encoding: gzip" http://localhost:8041
@AntonSmolkov
AntonSmolkov / gist:110fe7ae6b3ed337842a5be1a79db0c8
Last active May 7, 2021 09:46
Sample python gzip http post
from io import BytesIO
import gzip
import requests
def zip_payload(payload: str) -> bytes:
btsio = BytesIO()
g = gzip.GzipFile(fileobj=btsio, mode='w')
g.write(bytes(payload, 'utf8'))
g.close()
return btsio.getvalue()
using System;
using System.IO;
using System.IO.Compression;
using System.Net.Http;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
vector | May 07 09:12:44.989 TRACE mio::poll: registering event source with poller: token=Token(0), interests=READABLE | WRITABLE
vector | May 07 09:12:44.991 INFO vector::app: Log level is enabled. level="trace"
vector | May 07 09:12:44.991 INFO vector::sources::host_metrics: PROCFS_ROOT is unset. Using default '/proc' for procfs root.
vector | May 07 09:12:44.991 INFO vector::sources::host_metrics: SYSFS_ROOT is unset. Using default '/sys' for sysfs root.
vector | May 07 09:12:44.991 INFO vector::app: Loading configs. path=[("/etc/vector/vector.toml", Some(Toml))]
vector | May 07 09:12:44.997 INFO vector::topology: Running healthchecks.
vector | May 07 09:12:44.997 INFO vector::topology: Starting source. name="http_source"
vector | May 07 09:12:44.997 INFO vector::topology: Starting sink. name="out"
vector | May 07 09:12:44.997 INFO vector: Vector has started. version="0.13.1" git_version="v0.13.1" released="Thu, 29 Apr 2021 14:20:13 +0000" arch="x86_64"
@AntonSmolkov
AntonSmolkov / monzo-alertmanager-config.yaml
Created April 21, 2021 09:01 — forked from milesbxf/monzo-alertmanager-config.yaml
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@AntonSmolkov
AntonSmolkov / easyrsa3-quick-wildcardcert
Created November 27, 2020 21:23 — forked from DRN88/easyrsa3-quick-wildcardcert
easyrsa3-quick-wildcardcert
#!/bin/bash
FQDN="domain.local"
CERT_FILENAME="wildcard.${FQDN}"
CERT_COMMONNAME="*.${FQDN}"
wget "https://github.com/OpenVPN/easy-rsa/archive/master.zip"
unzip master.zip
mv easy-rsa-master/easyrsa3/ .
rm -rf master.zip easy-rsa-master/
@AntonSmolkov
AntonSmolkov / rancher-ha-cert-update.md
Created February 20, 2020 14:58 — forked from janeczku/rancher-ha-cert-update.md
rancher-ha-cert-update.md

Follow these steps to update the SSL certificate of the ingress in a Rancher High Availability installation or switch from the default self-signed to a custom certificate:

Create/Update the certificate secret resource

First, concat the server certificate followed by any intermediate certificate(s) to a file named tls.crt and provide the corresponding certificate key in a file named tls.key.

If you are switching the install from using the Rancher generated CA or a Let’s Encrypt issued certificates use the following command to create the tls-rancher-ingress secret resource in your Rancher HA cluster:

$ kubectl -n cattle-system create secret tls tls-rancher-ingress \
@AntonSmolkov
AntonSmolkov / kubernetes-filebeat.yaml
Created October 27, 2019 09:43 — forked from tkuther/kubernetes-filebeat.yaml
Filebeat kubernetes config with nginx module for ingress-nginx
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: filebeat
namespace: kube-system
labels:
k8s-app: filebeat
spec:
template:
metadata: