Skip to content

Instantly share code, notes, and snippets.

View v-kolesnikov's full-sized avatar
✍️
I'm writing something just now! You can write me too! 😉

Vasily Kolesnikov v-kolesnikov

✍️
I'm writing something just now! You can write me too! 😉
  • Russia
  • 04:59 (UTC +03:00)
View GitHub Profile
@v-kolesnikov
v-kolesnikov / time_libs.md
Created January 17, 2017 10:05
Awesome Time libraries
module Led
DIGITS = {
0 => [' _ ',
'| |',
'|_|'],
1 => [' ',
' | ',
' | '],
2 => [' _ ',
' _|',
@v-kolesnikov
v-kolesnikov / primes.exs
Created October 29, 2016 21:36
Решето Эратосфена.
def nth(n) when n < 2, do: [n]
def nth(n), do: Prime.iter((for x <- 2..n, do: x), [])
def iter([], primes), do: primes
def iter([x | xs], s) do
xs
|> Enum.filter(fn(n) -> rem(n, x) != 0 end)
|> Prime.iter([x | s])
end
@v-kolesnikov
v-kolesnikov / env_validation.rb
Created September 18, 2016 10:16 — forked from flash-gordon/env_validation.rb
ENV validation POC
require 'dry-validation'
class EnvValidation
class ENV
def inspect
ivs = instance_variables.each { |v| "#{v}=#{instance_variable_get(v)}" }.join(', ')
"ENV[#{ivs}]"
end
def to_s
(ns sicp.extra.hexlet
(:require [clojure.string :as s]))
(defn solution
[s]
(let [substrings (fn [i] (map (partial subs (str s) i) (range (inc i) (-> (str s) count inc))))
palindrome? (fn [s] (= (s/reverse s) s))]
(->> (str s)
(count)
(range 0)
@v-kolesnikov
v-kolesnikov / y_combinator.clj
Last active August 12, 2016 18:12
Y-Combinator
(defn factorial [n]
(let [y (fn [f] (f f))
f (fn [g] (fn [n] (if (zero? n) 1 (* n ((g g) (dec n))))))]
((y f) n)))
#%RAML 0.8
title: World Music API
baseUri: http://example.api.com/{version}
version: v1
schemas:
- halLink: |
{ "$schema": "http://json-schema.org/schema",
"type": "object",
"description": "a Hypertext Application Language link",
@v-kolesnikov
v-kolesnikov / gist:e667f2fe980ec1b27768776f188b714a
Created April 17, 2016 12:40 — forked from wikimatze/gist:9790374
Github Two-Factor Authentication Failed For HTTPS

I heard from GitHub Two-Factor Authentication](https://github.com/blog/1614-two-factor-authentication) nearly a couple of days ago when I was reading my RSS feed. I enabled it and couldn' push to any of my repositories anymore. Learn in this blog post how to fix it.

Two-Factor Authentication

"Is a process involving two stages to verify the identity of an entity trying to access services in a computer or in a network". Github solves this authentication with sending an SMS to a device which wants to push to their platform.

Enabling Two-Factor Authentication

@v-kolesnikov
v-kolesnikov / rubocop.md
Created April 9, 2016 20:05
rubocop blog
  • rubocop --auto-gen-config
  • remote configs
  • pronto
  • pronto fetch depth
  • editor integrations