Skip to content

Instantly share code, notes, and snippets.

View gliush's full-sized avatar

Ivan Glushkov gliush

View GitHub Profile
@gliush
gliush / levenshtein.go
Last active September 24, 2019 10:11
Find similar words in the file with "Levenshtein Distance" algorithm
// For more info read https://en.wikipedia.org/wiki/Levenshtein_distance
// Kudos to the original LD implementation:
// https://www.golangprograms.com/golang-program-for-implementation-of-levenshtein-distance.html
package main
import (
"bufio"
"fmt"
"os"
"strconv"
ScaleUpLimit = max(ScaleUpLimitMinimum, ScaleUpLimitFactor * currentReplicas)
NextReplicas = min(ScaleUpLimit, DesiredReplicas)
@gliush
gliush / upgrade.md
Created July 11, 2018 13:27 — forked from chrismccord/upgrade.md
Phoenix 1.2.x to 1.3.0 Upgrade Instructions

If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Bump your phoenix dep

Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs:

@gliush
gliush / .gitignore
Last active August 11, 2017 10:31
libphonenumber formatter and validator
.venv

Keybase proof

I hereby claim:

  • I am gliush on github.
  • I am gliush (https://keybase.io/gliush) on keybase.
  • I have a public key ASDZW92VVK-n6EdfOGjfL3oZfUzrT3oyyf8pOEPaqypBzgo

To claim this, I am signing this object:

@gliush
gliush / test.rs
Created March 2, 2016 14:15
How to make rust work?
// Run it with:
// echo -e "John Smith\nData1\nData2" > /tmp/in.txt; rustc test.rs && ./test
// Then change the output command in the loop in main() and try again
use std::io::prelude::*;
use std::fs::File;
use std::io::{BufReader,Stdout,self};
#[derive(Debug)]
pub struct Data<'a>{
name: &'a str,
@gliush
gliush / README.md
Last active August 29, 2015 14:11
meck fails while running 'meck:expect'

Here's a test project with 2 files that shows the problem.

You need 2 modules

  • in the first module you should have a eunit test
  • in the second module you should meck any function from the first module

When you run eunit, the meck fails at 'meck:expect' with 'undefined' exception.

How to reproduce:

@gliush
gliush / fp_oct.hs
Created October 10, 2014 10:58
fp contest, Oct
main = putStrLn "hello world"
@gliush
gliush / check_network.sh
Last active January 8, 2022 17:05
check_network
[ -z "$1" ] && echo "no logdir specified" && exit 2
[ -z "$2" ] && echo "no node specified" && exit 2
gen=$1
host=$2
mkdir $gen && cd $gen || exit 2
PERIOD="10mins"
end=`date -d +$PERIOD +%s`
@gliush
gliush / matrix.raw
Last active August 29, 2015 14:05
aug fp content
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
011101100111011101010111011101110111011100111011001110111010101110111011101110111001110110011101110101011101110111011101110
010100100001000101010100010000010101010100101001000010001010101000100000101010101001010010000100010101010001000001010101010
010100100111011101110111011100110111011100101001001110111011101110111001101110111001010010011101110111011101110011011101110
010100100100000100010001010100100101000100101001001000001000100010101001001010001001010010010000010001000101010010010100010
011101110111011100010111011100100111011100111011101110111000101110111001001110111001110111011101110001011101110010011101110
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
011101100111011101010111011101110111011100111011001110111010101110111011101110111001110110011101110101011101110111011101110
01010010000100010101010001000001