Skip to content

Instantly share code, notes, and snippets.

@maksar
maksar / About.md
Last active July 4, 2021 18:47
About.me

I was employed in Itransition for 15+ years, started as Junior developer, currently in VPE and SCO positions. Still write code (have tons of experience in Ruby/Rails and Java/Kotlin stacks) daily, but not for a full time. Proficient with DevOps (terraform) on AWS and deployment in general (chef, ansible, bash), love to configure and automate CI/CD servers (TeamCity mainly, but GitHub actions will kill it), all per projects (bots, utils) are getting deployed with NixOps (to keep me sane). Other activities in a company: SDLC processes, ISO certifications, tons of code reviews, developer's career schema, project audits, vulnerability scanning, automation activities.

I don't have a lot of experience with Haskell and want to get it. However, I wrote some thinks in Haskell:

  • Facebook chat bot interacting with a company's AD with LDAP (polysemy, QuickCheck, hspec, servant-client, servant-server, aeson, lens, haskeline, nix flakes)
  • JIRA parsing and aggregation (servant-client, template haskell, aeson, relude, att

Расширяемые функциональные эффекты против объектно-ориентированных интерфейсов.

С большим опозданием, продолжаю цикл статей про WP бота. Ссылки на предыдущие части: 1, 2 3 и 4. Сегодня, впрочем как обычно, речь пойдет про очедную функциональную дичь ;).

Столпом ООП является инкапсуляция (каждый раз тянет по английски это слово с i начать), которая про "сокрытие реализации". Даже самому начинающему программисту известно, что достигается инкапсуляция в mainstream языках программирования при помощи interface-ов. Я постараюсь показать совершенно иной способ инкапсуляции – экзистенциальные эффекты.

Что за а

def except(input)
input.map.with_index.with_object([]) { |(_e, i), r| r << (r.last || 1) * (i.zero? ? 1 : input[i - 1]) }
end
def solution(input)
except(input).zip(except(input.reverse).reverse).map { |pair| pair.inject(:*) }
end
def solution(input)
log_sum = input.map { |i| Math.log10(i) }.sum
input.map { |i| (10**(log_sum - Math.log10(i))).round }
end
def solution(input)
log_sum = input.map { |i| Math.log10(i) }.sum
input.map { |i| (10**(log_sum - Math.log10(i))).round }
end
#!/usr/bin/env ruby
# Copyright: https://gist.github.com/skanev/9d4bec97d5a6825eaaf6
# A sneaky wrapper around Rubocop that allows you to run it only against
# the recent changes, as opposed to the whole project. It lets you
# enforce the style guide for new/modified code only, as opposed to
# having to restyle everything or adding cops incrementally. It relies
# on git to figure out which files to check.
#
@maksar
maksar / makeapp.sh
Created June 6, 2017 08:11 — forked from demonbane/makeapp.sh
Create a Fluid-style app launcher for single-window Chrome instances on OSX
#!/bin/sh
echo "What should the Application be called (no spaces allowed e.g. GCal)?"
read inputline
name="$inputline"
echo "What is the url (e.g. https://www.google.com/calendar/render)?"
read inputline
url="$inputline"
require 'set'
class Workflow
def initialize(steps_config)
@steps_config = steps_config
@current_step = 0
@votes = Array.new(steps_config.size) { Set.new }
end
def approve(actor)
permissionProducer : Producer Permission
permissionProducer =
let permission i = case i of
1 -> VOTE
2 -> FORCE
_ -> NONE
in Check.Producer.map permission <| rangeInt 0 2
userProducer : Producer User
userProducer =
@maksar
maksar / sample.feature
Created January 26, 2014 21:29
feature
Feature: Identification process
Background:
Given following EGRUL source configuration
| step | suspicious_threshold | identification_threshold |
| 1 | 0 | 90 |
| 2 | 65 | 90 |
And following attributes weights
| inn | kpp | ogrn | okpo | short_name | full_name |
| 90 | 10 | 90 | 85 | 5 | 5 |
And following priorities