{{ message }}

Instantly share code, notes, and snippets.

💭

# Victor Maslov Nakilon

💭
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
Created Sep 9, 2014
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"
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
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
Last active Sep 7, 2015
C++ "almost" solution to Project Euler 111
View 111.cpp
 #include #include #include struct prime { int32_t value; prime* next; }; prime primes = { 2, NULL }; prime* tail = ℙ
Created Sep 24, 2015
View id_rsa.pub
Last active Apr 12, 2020
small example
View Starbound v1.0
 \$ ruby recipes.rb Carrot Potato Bandage 1 roastedcarrot = 1 Carrot 1 carrotjuice = 1 Carrot 1 bakedpotato = 1 Potato 1 mashedpotato = 1 Potato 1 potatogrids = 2 Mashed Potato By default all consumables are assumed to: 1) WellFed you 2) be blocked if you are WellFed already 3) Heal in 60 seconds
Last active Apr 12, 2020
big example
View Starbound v1.0
 \$ ruby recipes.rb Automato Avesmingo Banana Carrot Cocoa\ Pod Corn Currentcorn Grapes Pearlpeas Pineapple Potato Rice Tomato Wheat Sugar Beakseed 1 automatostew = 1 Wheat + 1 Currentcorn + 1 Automato 1 2kbpotage = 1 Currentcorn + 1 Automato 1 candyautomato = 1 Sugar + 1 Automato 1 avesmingojuice = 1 Avesmingo 1 apegrapes = 1 Grapes + 1 Banana 1 batteredbanana = 1 Wheat + 1 Banana 1 luckydip = 1 Carrot + 1 Banana 1 roastedcarrot = 1 Carrot 1 carrotjuice = 1 Carrot
Last active Jul 26, 2016
View dick_loop.rb
 ‐=!ϐ=ʚ=‐ ʚ.define_singleton_method(:<<){|∣|@∣=∣} ʚ.define_singleton_method(:-){|∣|∣ if-1<@∣-=1} ʚ << 4 until ϐ==ʚ-‐ puts "he" end
Last active May 28, 2021
new macOS configuration checklist
View checklist.md
• настроить все в System Preferences, например

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

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