-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
19,453 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
## | ||
# check image hash | ||
|
||
files = Dir.glob( "../welovepunks/i/*.png" ) | ||
puts " #{files.size} file(s)" | ||
#=> 5000 file(s) | ||
|
||
HASHES = {} | ||
|
||
files.each_with_index do |file,i| | ||
basename=File.basename( file, File.extname( file)) | ||
num = basename.sub( 'punk', '' ).to_i(10) | ||
|
||
blob = read_blob( file ) | ||
hash = Digest::SHA256.hexdigest( blob ) | ||
HASHES[ hash ] ||= [] | ||
HASHES[ hash] << num | ||
|
||
print "." | ||
print i if i % 100 == 0 | ||
end | ||
print "\n" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
require 'cocos' | ||
|
||
require 'digest' | ||
|
||
$LOAD_PATH.unshift( "../pixelart/ordbase/ordinals/lib" ) | ||
require 'ordinals' | ||
require 'ordlite' | ||
require 'date' | ||
|
||
|
||
|
||
require_relative 'base' ## build HASHES lookup/table | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
OrdDb.open( './ord.db' ) | ||
|
||
puts | ||
puts " #{Inscribe.count} inscribe(s)" | ||
puts " #{Blob.count} blob(s)" | ||
|
||
|
||
|
||
NODE_PUNKS = [] | ||
|
||
# limit = 100 | ||
# Inscribe.order( :num ).limit( limit ).each do |inscribe| | ||
|
||
### | ||
## 8:23 PM Central / 9:23 PM Eastern on 12/3/23 | ||
## I took the screenshot before it loaded | ||
## 8:20 pm => 2023/12/04 02:20 | ||
## | ||
## block 819665 -2023-12-04 02:13:02 UTC | ||
## - first inscription num. -> 45910612 | ||
|
||
|
||
=begin | ||
## delete "front-runners" - no "front-runners" found | ||
Inscribe.order( :num ).where( 'num < 45910612' ).each do |inscribe| | ||
if File.exist?( "./punks/#{inscribe.num}.png" ) | ||
puts "!! deleting punk #{inscribe.num}" | ||
elsif File.exist?( "./other/#{inscribe.num}.png" ) | ||
## skip | ||
else ## download and image check | ||
end | ||
end | ||
=end | ||
|
||
|
||
|
||
Inscribe.order( :num ).each do |inscribe| | ||
|
||
if File.exist?( "./punks/#{inscribe.num}.png" ) | ||
NODE_PUNKS << inscribe.num | ||
elsif File.exist?( "./other/#{inscribe.num}.png" ) | ||
## skip | ||
else ## download and image check | ||
content = Ordinals.content( inscribe.id ) | ||
## pp content | ||
|
||
image_hash = Digest::SHA256.hexdigest( content.data ) | ||
pp image_hash | ||
|
||
punk_nums = HASHES[ image_hash ] | ||
|
||
if punk_nums | ||
puts " bingo!!" | ||
write_blob( "./punks/#{inscribe.num}.png", content.data) | ||
NODE_PUNKS << inscribe.num | ||
else | ||
puts " x(num)" | ||
write_blob( "./other/#{inscribe.num}.png", content.data) | ||
end | ||
end | ||
end | ||
|
||
|
||
pp NODE_PUNKS | ||
puts " #{NODE_PUNKS.size} punk(s)" | ||
|
||
puts "bye" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
require 'cocos' | ||
|
||
require 'digest' | ||
|
||
|
||
|
||
## | ||
# check image hash | ||
|
||
files = Dir.glob( "../welovepunks/i/*.png" ) | ||
puts " #{files.size} file(s)" | ||
#=> 5000 file(s) | ||
|
||
|
||
hashes = {} | ||
|
||
files.each_with_index do |file,i| | ||
basename=File.basename( file, File.extname( file)) | ||
num = basename.sub( 'punk', '' ).to_i(10) | ||
|
||
blob = read_blob( file ) | ||
hash = Digest::SHA256.hexdigest( blob ) | ||
hashes[ hash ] ||= [] | ||
hashes[ hash] << num | ||
|
||
print "." | ||
print i if i % 100 == 0 | ||
end | ||
print "\n" | ||
|
||
## check if any duplicates? | ||
duplicates = Hash.new(0) | ||
hashes.each do |hash, nums| | ||
if nums.size > 1 | ||
puts "!! #{hash}" | ||
pp nums | ||
|
||
duplicates[nums.size] += 1 | ||
end | ||
end | ||
|
||
#=> 279 duplicates!! | ||
|
||
puts "duplicates:" | ||
pp duplicates | ||
|
||
## | ||
## {2 => 234, | ||
## 3 => 29, | ||
# 4 =>6, | ||
# 5 =>3, | ||
# 6 =>3 | ||
# 7 =>1, | ||
# 8 =>1, | ||
# 13 =>2, | ||
|
||
puts "bye" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
## | ||
# check max filesize | ||
|
||
|
||
files = Dir.glob( "../welovepunks/i/*.png" ) | ||
puts " #{files.size} file(s)" | ||
#=> 5000 file(s) | ||
|
||
max = 0 | ||
files.each do |file| | ||
bytes = File.size( file ) | ||
max = bytes > max ? bytes : max | ||
end | ||
|
||
puts "max: #{max} bytes" | ||
#=> max: 372 bytes !!! | ||
|
||
|
||
|
||
puts "bye" |
Oops, something went wrong.