Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
geraldb committed Jan 28, 2024
1 parent 0df7b23 commit 4dca9c0
Show file tree
Hide file tree
Showing 9 changed files with 19,453 additions and 0 deletions.
18,638 changes: 18,638 additions & 0 deletions ordzaar/inscriptions.json

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions sandbox/base.rb
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"



87 changes: 87 additions & 0 deletions sandbox/find.rb
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"
57 changes: 57 additions & 0 deletions sandbox/hashcheck.rb
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"
21 changes: 21 additions & 0 deletions sandbox/length.rb
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"
Loading

0 comments on commit 4dca9c0

Please sign in to comment.