-
Notifications
You must be signed in to change notification settings - Fork 3
/
grapher.rb
51 lines (40 loc) · 1.55 KB
/
grapher.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'date'
# █████████████████████████
# █████████████████████████
# █████████████████████████
# █████████████████████████
# █████████████████████████
# █████████████████████████
# █████████████████████████
PATTERN = <<-EOF.split("\n").map{|line| line.split(//)}.transpose.map(&:join).join
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXX
EOF
MASK = PATTERN.split(//).map{|c| c == 'X'}
DAYSTART = Date.new(2015,12,21)
DAYEND = DAYSTART + (PATTERN.size*4)
# def test_pattern
# (0..6).map{|n| (PATTERN.split(//)*3).each_with_index{|c,i| print c if i%7==n}; print "\n"}
# end
dates = DAYSTART.upto( DAYEND ).to_a
def on?(date)
delta = (date - DAYSTART).to_i
MASK[ delta % MASK.size ]
end
commit_dates = []
dates.each do |date|
if on?(date)
22.times{|i| commit_dates << date.to_time + i*3600}
end
end
str_commit_dates = commit_dates.map(&:to_s)
commit_dates.each do |date|
puts date
File.open('random_list_of_dates', 'w') { |f| f << str_commit_dates.shuffle.first(12).join("\n") }
`GIT_AUTHOR_DATE="#{date}" GIT_COMMITTER_DATE="#{date}" git commit -am "#{date}"`
end