Skip to content

Instantly share code, notes, and snippets.

View Bablzz's full-sized avatar
💭
Quality is remembered long after the price is forgotten (Sir Frederick Royce)

Maksim Sokolnikov Bablzz

💭
Quality is remembered long after the price is forgotten (Sir Frederick Royce)
View GitHub Profile
@Bablzz
Bablzz / tower.py
Created November 20, 2019 11:52
Tower of Hanoi
def solve(n, a, b, c):
if n > 0:
solve(n - 1, a, c, b)
print('Move disk from ' + a + ' to disk ' + b)
solve(n - 1, c, b, a)
solve(3, '1', '2', '3')
@Bablzz
Bablzz / fib_memo.rb
Last active December 13, 2019 13:32
Fibonacci with memoization
memo = Hash.new(0)
def fib_rec (number, memo)
if number == 0
return number
elsif (number == 1) || (number == 2)
return 1
end
if (memo.has_key?(number))
return memo[number]
@Bablzz
Bablzz / insertion_sort.rb
Created December 13, 2019 13:30
Insertion sort
# O(n^2)
def insertion_sort arr
i = 0
j = 0
for i in 1...(arr.length) do
key = arr[i]
j = i - 1
while j >= 0 and key < arr[j] do
arr[j + 1] = arr[j]
@Bablzz
Bablzz / example.md
Last active March 26, 2020 07:32
Some reason do not build docker by Packer
  1. Packer change entrypoint. This is obscure if you are just trying packer. You can read this here

  2. Packer doesn't work with scratch/distroless images(and another without bash) If your docker image has no bash packer does not build your image. See here

  3. Packer has no some docker command like copy. See here