Skip to content

Instantly share code, notes, and snippets.

Alexey Diyan diyan

Block or report user

Report or block diyan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@diyan
diyan / aws_sdk_v2_ecs_config.kt
Last active Dec 18, 2019
ECS. AutoScaling config, Service placement, container limits in Kotlin
View aws_sdk_v2_ecs_config.kt
import com.fasterxml.jackson.annotation.JsonPropertyOrder
import com.fasterxml.jackson.dataformat.csv.CsvMapper
import software.amazon.awssdk.services.ecs.EcsClient
import software.amazon.awssdk.services.ecs.model.DescribeClustersRequest
import software.amazon.awssdk.services.ecs.model.DescribeServicesRequest
import software.amazon.awssdk.services.ecs.model.DescribeTaskDefinitionRequest
import software.amazon.awssdk.services.ecs.model.ListServicesRequest
import java.util.concurrent.ForkJoinPool
import java.util.concurrent.TimeUnit
import kotlin.streams.asSequence
@diyan
diyan / wine416_staging__dotnet416_devpack.md
Last active Sep 30, 2019
WORKS. Setup Wine 4.16 Staging, winetricks, .NET 4.6.1 Developer Pack, NuGet. Compile ASP.NET Web Forms Web Site using Wine/MSBuild
View wine416_staging__dotnet416_devpack.md
FROM debian:9.11
# Wine on Debian 9, see https://wiki.winehq.org/Debian
# Winetricks, see https://wiki.winehq.org/Winetricks#Installing_winetricks
# WINEDEBUG=-all to suppress Wine debug output
# .NET Runtime via Winetricks, install sequence:
#   v4.0 on WinXP, v4.5 on Win7, v4.6 on Win2003, v4.6.1 on Win7.
RUN set -x \
    && tempDeps='software-properties-common apt-transport-https gnupg wget curl cabextract' \
    && apt-get update \
@diyan
diyan / wine402_aspnet461.md
Last active Sep 30, 2019
FAILED experiment. Setup Wine, winetricks, dotnet461, NuGet. Compile ASP.NET Web Forms Web Site using Wine/MSBuild
View wine402_aspnet461.md
FROM debian:9.11
# Wine on Debian 9, see https://wiki.winehq.org/Debian
# Winetricks, see https://wiki.winehq.org/Winetricks#Installing_winetricks
RUN set -x \
    && tempDeps='software-properties-common apt-transport-https gnupg wget curl cabextract' \
    && apt-get update \
    && apt-get install -y --no-install-recommends $tempDeps \
    && dpkg --add-architecture i386 \
    && wget -qO - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - \
@diyan
diyan / aws_sdk_v2_ecs_config.scala
Last active Dec 17, 2019
ECS. AutoScaling config, Service placement, container limits in Scala
View aws_sdk_v2_ecs_config.scala
package sample
import java.util.concurrent.TimeUnit
import com.fasterxml.jackson.dataformat.csv.CsvSchema.ColumnType
import com.fasterxml.jackson.dataformat.csv.{CsvMapper, CsvSchema}
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import software.amazon.awssdk.services.ecs.EcsClient
import software.amazon.awssdk.services.ecs.model.{DescribeClustersRequest, DescribeServicesRequest, DescribeTaskDefinitionRequest, ListServicesRequest}
@diyan
diyan / aws_sdk_v2_ecs_config_foreach_method.scala
Created Jun 7, 2019
Boring but parallel loops in Scala using "foreach" method
View aws_sdk_v2_ecs_config_foreach_method.scala
import java.util.concurrent.TimeUnit
import software.amazon.awssdk.services.ecs.EcsClient
import software.amazon.awssdk.services.ecs.model.{DescribeServicesRequest, ListServicesRequest}
import scala.collection.JavaConverters._
object EcsAutoScalingReport extends App {
val startTime = System.nanoTime()
@diyan
diyan / aws_sdk_v2_ecs_config_for_keyword.scala
Last active Jun 7, 2019
Boring but parallel loops in Scala using "for" keyword
View aws_sdk_v2_ecs_config_for_keyword.scala
import java.util.concurrent.TimeUnit
import software.amazon.awssdk.services.ecs.EcsClient
import software.amazon.awssdk.services.ecs.model.{DescribeServicesRequest, ListServicesRequest}
import scala.collection.JavaConverters._
object EcsAutoScalingReport extends App {
val startTime = System.nanoTime()
@diyan
diyan / language_verbosity.md
Last active Sep 20, 2018
Verbosity of Different Programming Languages
View language_verbosity.md

Verbosity of Different Programming Languages

Task: decode base64 string then decompress byte array then overwrite the value

Python version

if event.data:
    event.data = zlib.decompress(base64.b64decode(event.data))

Go version

@diyan
diyan / eval_kops.md
Created Aug 10, 2017
Setup Kubernetes cluster using kops provisioning tool
View eval_kops.md

Setup Kubernetes cluster using kops provisioning tool

Install kops, kubectl on workstation

$ wget -O ~/.local/bin/kops https://github.com/kubernetes/kops/releases/download/1.7.0/kops-linux-amd64
$ chmod +x ~/.local/bin/kops

$ wget -O ~/.local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.7.2/bin/linux/amd64/kubectl
$ chmod +x ~/.local/bin/kubectl
View json_log_event.js
// Majority attributes are optional.
// The only required attributes are created_at, logger, level and either event + args or message.
{
"created_at": "2016-12-31T23:59:59Z",
"forwarded_at": "2017-01-01T00:00:00Z",
"logger": "foo.bar.baz.module",
"level": "INFO",
// V1. Classic, unstructured log event
"message": "OrderID '44444444-3333-2222-1111-000000000000' was not found",
@diyan
diyan / error_handling_styles.go
Created Mar 14, 2017
Error handling in Golang with style =)
View error_handling_styles.go
func UpgradeDB_BoringStyle(databaseURL string) error {
box, err := rice.FindBox("postgres")
if err != nil {
return errors.Wrap(err, "can not find db migrations")
}
sourceDriver, err := source.WithInstance(box)
if err != nil {
return errors.Wrap(err, "can not init source driver for db migrations")
}
m, err := migrate.NewWithSourceInstance("go.rice", sourceDriver, databaseURL)
You can’t perform that action at this time.