Skip to content

Instantly share code, notes, and snippets.

@Nakilon
Nakilon / 1.txt
Created September 18, 2026 09:27
top 664 English words for vocabulary learning
100199 you
50000 I
33333 to
16666 and
14285 that
12500 it
11111 of
10000 me
9090 what
8333 is
@Nakilon
Nakilon / 0 info.md
Last active June 9, 2026 09:20
'World of Ambient' archive
@Nakilon
Nakilon / main.txt
Created June 3, 2026 03:14
chess psychological approach #2: PCBR
1.
e4 59% +0.2
d4 25% +0.2
Nf3 4% +0.1
c4 3% +0.1
e3 2% 0.0
g3 2% +0.1
b3 2% 0.0
f4 1% -0.2
d3 1% -0.1
@Nakilon
Nakilon / slbsa.rb
Created August 7, 2025 02:45
SLBSA
require "set"
class SLBSA
def initialize max_size, &block
@max_size = max_size
@values = []
@scores = []
@calculate = block
@set = Set.new
end
def push value
@Nakilon
Nakilon / slbsa.rb
Last active July 5, 2025 18:51
size-limited binary-search array
require "set"
class SLBSA
def initialize max_size, &block
@max_size = max_size
@values = []
@scores = []
@calculate = block
@set = Set.new
end
def to_a
@Nakilon
Nakilon / table_print.rb
Created July 4, 2025 20:07
table_print.rb
require "io/console"
def table_print target = ::STDOUT
sizes = transpose.map{ |col| col.map{ |_| _.to_s.size }.max }
sizes.max.then{ |max| sizes.map!{ |_| [max - 1, _].min } } while sizes.sum + sizes.size >= ::IO::console.winsize[1]
each{ |row| target.puts row.zip(sizes).map{ |str, size| "%-#{size}s" % ("%.#{size}s" % str) }.join(" ") }
end
@Nakilon
Nakilon / self-currying.rb
Created July 4, 2025 12:26
self-currying
Config = lambda do
dir = nil
lambda do |_dir = nil|
dir ||= _dir
p dir
end
end.call
Config.()
Config.("asd")
@Nakilon
Nakilon / gist:1d1a741ab29176ffa7873e5a10338347
Created May 11, 2025 15:37 — forked from larsthegeek/gist:4029012
Update RubyGems to a specific version (for legacy system installs)
How to update RubyGems to a specific version
RubyGems can update itself to the latest version:
gem update --system
However, you always get the newest version. This may be a problem if you’re trying to replicate a known-good environment: for example, the output format of `gem list` in RubyGems 1.3.7 breaks Chef 0.8.16 in certain circumstances. 1.3.6 is fine.
Here’s how to update to a specific version—in this case, 1.3.6:
gem install -v 1.3.6 rubygems-update && \
@Nakilon
Nakilon / code.rb
Created October 17, 2024 15:54
largest indentation
module Cainiao
...
def self.main login, password, month, from, to, log_bt = false
...
@mutex.synchronize do
...
[true, xlsx_string[
paginate.call ->{
YAML::Store.new("cache.yaml").transaction do |store|
table.tap{ |_| fail unless 1 <= _.size }.flat_map.with_index do |act, i|
docker
install
(https://stackoverflow.com/q/61401626/322020)
$ sudo apt-get update
$ sudo apt install -y docker.io
disable shutting down on Ubuntu's "daily upgrade"
$ sudo apt-mark hold docker.io
check autorun
$ sudo systemctl is-enabled docker.service
$ sudo systemctl is-enabled containerd.service