Skip to content

Instantly share code, notes, and snippets.

@artemklevtsov
artemklevtsov / enum.go
Created May 26, 2022 18:33 — forked from lummie/enum.go
Golang Enum pattern that can be serialized to json
package enum_example
import (
"bytes"
"encoding/json"
)
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred
type TaskState int
@artemklevtsov
artemklevtsov / radix.nim
Created February 21, 2022 16:40 — forked from treeform/radix.nim
Radix sort in Nim.
## Radix sort in O(n) unlike other sorting methods that can be way worse.
## But radix sort needs the bits to operate on, which makes it different then
## other sorting algorithms.
proc getMax(arr: seq[SomeInteger]): SomeInteger =
for i, e in arr:
if i == 0:
result = e
elif e > result:
result = e
@artemklevtsov
artemklevtsov / ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
Created February 10, 2019 07:42 — forked from Brainiarc7/ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
ffmpeg livestreaming to youtube via Nvidia's NVENC and Intel's VAAPI on supported hardware

Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:

Considerations to take when live streaming:

The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:

  1. Compute the optimal buffer size (-bufsize:v) for hardware-based encoders as shown:

bufsize=4(target bitrate/frame rate)

@artemklevtsov
artemklevtsov / gist:85545e14405d7a39cded02747eeaf899
Created January 22, 2019 14:01 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt