Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
geraldb committed Aug 7, 2023
1 parent 6951c5b commit 8b583f9
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ tmp32/
tmp40/
tmp2017/
tmpa16z/
tmpv2/



Expand Down
60 changes: 60 additions & 0 deletions generate_v2/diypunks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
####
# to run use
# $ ruby generate_v2/diypunks.rb


$LOAD_PATH.unshift( "../ordbase/ordinals/lib" )
$LOAD_PATH.unshift( "../ordbase/ordlite/lib" )
require 'ordlite'



OrdDb.open( './ord.db' )


## note: change outdir (root for /num & /diypunks)
## to where you want to save the generated images
# outdir = '../ordbase.github.io'
outdir = './tmpv2'



## step 1 - read database "factory" record, that is, ordgen / ORC-721 deploy inscribe
rec = Factory.find( 'diypunks' )

puts "==> #{rec.id} >#{rec.name}< max. #{rec.max} - #{rec.dim} - inscribe no. #{rec.inscribe.num} - #{rec.inscribe.date}"

puts " #{rec.layers.count} layer(s):"

generator = rec.generator
puts " #{generator.count} tile(s)"


## step 2 - read mint records
recs = read_csv( "./diypunks/mint.csv" )
puts " #{recs.size} record(s)"

# cut-down to max. limit
# recs = recs[0, 100]
# puts " #{recs.size} record(s)"


## step 3 - auto-generate public images
recs.each_with_index do |rec,i|
num = rec['num']
g = generator._parse( rec['g'] )

puts "==> punk no. #{i} @ #{num} - g: #{g.inspect}"

img = generator.generate( *g )

img.save( "#{outdir}/num/#{num}.png" )
img.zoom(4).save( "#{outdir}/num/#{num}@4x.png" )

img.save( "#{outdir}/diypunks/#{g.join('_')}.png" )
img.zoom(4).save( "#{outdir}/diypunks/#{g.join('_')}@4x.png" )
end


puts "bye"

51 changes: 51 additions & 0 deletions pipeline/generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
$LOAD_PATH.unshift( "../ordbase/ordinals/lib" )
$LOAD_PATH.unshift( "../ordbase/ordlite/lib" )
require 'ordlite'


require_relative 'config'


OrdDb.open( './ord.db' )

diypunks = Factory.find( 'diypunks' )
puts " inscribe no. #{diypunks.inscribe.num} - #{diypunks.inscribe.date}"
#=> inscribe no. 9947030 - 2023-05-29 16:38:27 UTC

punk = diypunks.generate( 0,15,31,44,54 )

punk.save( "./tmpv2/punk.png" )
punk.zoom(4).save( "./tmpv2/punk@4x.png" )


__END__




recs = Factory.joins(:inscribe).order('num desc').to_a
recs.each_with_index do |rec,i|

puts "==> #{i+1} #{rec.id} >#{rec.name}< max. #{rec.max} - #{rec.dim}"

puts " #{rec.layers.count} layer(s):"

generator = rec.generator
puts " #{generator.count} tile(s)"

## double check counts
slug = rec.id
deploy = DEPLOYS[ slug ]
pp deploy
if deploy['g'] != generator.count
puts "!! ERROR - tile count (max g number) mismatch; got #{generator.count} - expected #{deploy['g']}"
exit 1
end

g = [0]
sample = rec.generate( *g )
sample.save( "./tmp/#{slug}-#{g.join('-')}.png" )
end


puts "bye"
83 changes: 83 additions & 0 deletions preview_v2/diypunks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
####
# to run use
# $ ruby preview_v2/diypunks.rb


$LOAD_PATH.unshift( "../ordbase/ordinals/lib" )
$LOAD_PATH.unshift( "../ordbase/ordlite/lib" )
require 'ordlite'


OrdDb.open( './ord.db' )


## step 1 - read database "factory" record, that is, ordgen / ORC-721 deploy inscribe
rec = Factory.find( 'diypunks' )

puts "==> #{rec.id} >#{rec.name}< max. #{rec.max} - #{rec.dim} - inscribe no. #{rec.inscribe.num} - #{rec.inscribe.date}"

puts " #{rec.layers.count} layer(s):"

generator = rec.generator
puts " #{generator.count} tile(s)"




specs = [
[0],
[0,23,44],
[0,38],
[59,0,38],
[1,27,38],
[58,9,28,38],
[0,15,31,44,54],
[0,40,43,30],
[59,0,47,44,29],

## preview asked for
[5,10],
[0,26,38,41],
[8,11,57],
[8,57,11],
[5,27,38,55,57],
[5,27,57,38,55],
[5,57,38,55],

[59,5,21,38,48,55],
[59,5,21,38,55],
[59,5,38,48,55],

[1, 34, 42, 48],


[6, 35, 54, 55],
[6, 37, 54, 55],


[59, 5, 26, 38, 43],

[4,17,36,51],
[59, 4, 26, 37, 44, 55, 57],

# konf..
[1,34,42,48],
[5,34,42,48],

# more
[58,4,19],
]


specs.each do |attributes|
puts "==> punk #{attributes.inspect}"
punk = generator.generate( *attributes )

path = "./preview_v2/tmp/punk-#{attributes.join('_')}"
punk.save( path+'.png' )
punk.zoom(4).save( path+'@4x.png' )
end



puts "bye"

0 comments on commit 8b583f9

Please sign in to comment.