Skip to content

Instantly share code, notes, and snippets.

💭
:trollface:

Victor Maslov Nakilon

💭
:trollface:
Block or report user

Report or block Nakilon

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
@Nakilon
Nakilon / 2048.rb
Last active Jun 10, 2016
2048 golfed to 379 chars in Ruby by Nakilon for http://www.reddit.com/r/tinycode/comments/22wozn/
View 2048.rb
require"io/console"
_=[[_]*4]*4
t=->{_=_.transpose}
r=->{_.map! &:reverse}
f=->{_=_.map{|_|_=(_*?\s).gsub(/\b(\d+) +\1\b/){|_|_.to_i*2}.split;_[3]||=p;_}}
f[]
loop{(0while _[i=rand(4)][j=rand(4)];_[i][j]=[*[?2]*9,?4].sample)if$n!=_*?_
system"clear"
_.map{|_|puts"%5s"*4%_}
(c=STDIN.getch)[?q]|0
View Erdos
a=*$<.map{|s|s.scan /[a-z]+/i}
a[0]+=x=[i=0]
a.map{n=*x
a.map{|b|(b&x)[0]&&n+=b}
exit p i if(["Erdos"]&x=n)[0]
i+=1}
puts"Inf"
@Nakilon
Nakilon / prime.cr
Last active Sep 7, 2015
prime? method (in fact a lambda) implemented in Crystal
View prime.cr
macro break_if_enough divisible, divisor, to_return = nil
q, r = {{divisible}}.divmod {{divisor}}
{% if to_return %}
return false if r == 0
return true if q <= {{divisor}}
{% else %}
break false if r == 0
break true if q <= {{divisor}}
{% end %}
end
@Nakilon
Nakilon / 111.cr
Created Sep 7, 2015
Crystal "almost" solution to Project Euler 111
View 111.cr
macro break_if_enough divisible, divisor, to_return = nil
q, r = {{divisible}}.divmod {{divisor}}
{% if to_return %}
return false if r == 0
return true if q <= {{divisor}}
{% else %}
break false if r == 0
break true if q <= {{divisor}}
{% end %}
end
@Nakilon
Nakilon / 111.cpp
Last active Sep 7, 2015
C++ "almost" solution to Project Euler 111
View 111.cpp
#include <stdio.h>
#include <assert.h>
#include <math.h>
struct prime {
int32_t value;
prime* next;
};
prime primes = { 2, NULL };
prime* tail = &primes;
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKOJygfeqxk6yVuQdEdarz7BRtYKOa15NpzVhWdt9BltQY3y9R74UpEbYAd3/C3Fax+mQp4kJy7eBO4wxRBUl0/EIkMq691dwAajLK3U0nZylWRZDUjNpXMhZ8W1W95xv3/Li3o4ssi3Ns9Dkny7/aQOVPl/ggUFIG4jVebkxcv0b0b84Aq6jEGwIV8Og1Ps2FjoHvUw1SlAoNj2wRQfMW6BzbzOkyCeTwzl7gk2D1f8XysyY0WeJGQn3m3WnTAY8oSDLCCSzUNbP/swekdGf5j9M3ldhlf9OJb39/aq+dYCDItteu/KQj5av8btn4ntmv8Gf+y5O+n3AuXD7VQwh7 nakilon@nakibook.local
View dick_loop.rb
==ʚ=
ʚ.define_singleton_method(:<<){|∣|@∣=∣}
ʚ.define_singleton_method(:-){|∣|∣ if-1<@∣-=1}
ʚ << 4
until ϐ==ʚ-
puts "he"
end
@Nakilon
Nakilon / checklist.md
Last active Aug 16, 2019
newly installed Mac OS configuration checklist
View checklist.md
  • настроить все в System Preferences, например

    • выключить Correct spelling automatically
    • инвертировать кнопку Fn
    • поставить раскладки "США" (на новых макбуках тильды будет слева внизу) и "Русская - ПК"
  • выключить ускорение указателя трекпада и перелогиниться

    defaults write .GlobalPreferences com.apple.trackpad.scaling -1
  • настроить Finder (войти в настройки любой программы в Mac OS можно комбинацией ⌘,)

View net_http_utils.gemspec
Gem::Specification.new do |spec|
spec.name = "net_http_utils"
spec.summary = ??
spec.version = "0.2"
spec.author = "Victor Maslov"
spec.files = %w{ net_http_utils.rb }
spec.require_path = "."
end
@Nakilon
Nakilon / Gemfile
Last active Sep 18, 2016
azona bot
View Gemfile
source "https://rubygems.org"
gem "net_http_utils", ?0, gist: "97549ceb58d21e1fcbc0e6cdaf92fce8"
gem "nokogiri"
gem "byebug"
You can’t perform that action at this time.